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