xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/PR9902.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
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, bool = false>
5*f4a2713aSLionel Sambuc struct __allocator_traits_rebind
6*f4a2713aSLionel Sambuc {
7*f4a2713aSLionel Sambuc };
8*f4a2713aSLionel Sambuc 
9*f4a2713aSLionel Sambuc template <template <class, class...> class _Alloc, class _Tp, class ..._Args,
10*f4a2713aSLionel Sambuc class _Up>
11*f4a2713aSLionel Sambuc struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, false>
12*f4a2713aSLionel Sambuc {
13*f4a2713aSLionel Sambuc    typedef _Alloc<_Up, _Args...> type;
14*f4a2713aSLionel Sambuc };
15*f4a2713aSLionel Sambuc 
16*f4a2713aSLionel Sambuc template <class Alloc>
17*f4a2713aSLionel Sambuc struct allocator_traits
18*f4a2713aSLionel Sambuc {
19*f4a2713aSLionel Sambuc    template <class T> using rebind_alloc = typename __allocator_traits_rebind<Alloc, T>::type;
20*f4a2713aSLionel Sambuc    template <class T> using rebind_traits = allocator_traits<rebind_alloc<T>>;
21*f4a2713aSLionel Sambuc };
22*f4a2713aSLionel Sambuc 
23*f4a2713aSLionel Sambuc template <class T>
24*f4a2713aSLionel Sambuc struct allocator {};
25*f4a2713aSLionel Sambuc 
main()26*f4a2713aSLionel Sambuc int main()
27*f4a2713aSLionel Sambuc {
28*f4a2713aSLionel Sambuc    allocator_traits<allocator<char>>::rebind_alloc<int> a;
29*f4a2713aSLionel Sambuc }
30