1// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
2
3template <class _Tp, class _Up>
4struct __allocator_traits_rebind
5{
6    typedef typename _Tp::template rebind<_Up>::other type;
7};
8
9template <class Alloc>
10struct allocator_traits
11{
12    typedef Alloc allocator_type;
13    template <class T> using rebind_alloc = typename
14__allocator_traits_rebind<allocator_type, T>::type;
15    template <class T> using rebind_traits = allocator_traits<rebind_alloc<T>>;
16};
17
18template <class T>
19struct ReboundA {};
20
21template <class T>
22struct A
23{
24    typedef T value_type;
25
26    template <class U> struct rebind {typedef ReboundA<U> other;};
27};
28
29int main()
30{
31    allocator_traits<A<char> >::rebind_traits<double> a;
32}
33