Richard Smith | 762bb9d | 2011-10-13 22:29:44 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s |
Richard Smith | aff37b4 | 2011-05-12 00:06:17 +0000 | [diff] [blame] | 2 | |
| 3 | template <class _Tp, class _Up, bool = false> |
| 4 | struct __allocator_traits_rebind |
| 5 | { |
| 6 | }; |
| 7 | |
| 8 | template <template <class, class...> class _Alloc, class _Tp, class ..._Args, |
| 9 | class _Up> |
| 10 | struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, false> |
| 11 | { |
| 12 | typedef _Alloc<_Up, _Args...> type; |
| 13 | }; |
| 14 | |
| 15 | template <class Alloc> |
| 16 | struct allocator_traits |
| 17 | { |
| 18 | template <class T> using rebind_alloc = typename __allocator_traits_rebind<Alloc, T>::type; |
| 19 | template <class T> using rebind_traits = allocator_traits<rebind_alloc<T>>; |
| 20 | }; |
| 21 | |
| 22 | template <class T> |
| 23 | struct allocator {}; |
| 24 | |
| 25 | int main() |
| 26 | { |
| 27 | allocator_traits<allocator<char>>::rebind_alloc<int> a; |
| 28 | } |