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