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