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 | 1804174 | 2011-05-14 15:04:18 +0000 | [diff] [blame] | 2 | |
| 3 | template <class _Tp, class _Up> |
| 4 | struct __allocator_traits_rebind |
| 5 | { |
| 6 | typedef typename _Tp::template rebind<_Up>::other type; |
| 7 | }; |
| 8 | |
| 9 | template <class Alloc> |
| 10 | struct allocator_traits |
| 11 | { |
| 12 | typedef Alloc allocator_type; |
| 13 | template <class T> using rebind_alloc = typename |
| 14 | __allocator_traits_rebind<allocator_type, T>::type; |
| 15 | template <class T> using rebind_traits = allocator_traits<rebind_alloc<T>>; |
| 16 | }; |
| 17 | |
| 18 | template <class T> |
| 19 | struct ReboundA {}; |
| 20 | |
| 21 | template <class T> |
| 22 | struct A |
| 23 | { |
| 24 | typedef T value_type; |
| 25 | |
| 26 | template <class U> struct rebind {typedef ReboundA<U> other;}; |
| 27 | }; |
| 28 | |
| 29 | int main() |
| 30 | { |
| 31 | allocator_traits<A<char> >::rebind_traits<double> a; |
| 32 | } |