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