Douglas Gregor | befc20e | 2009-03-26 00:10:35 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
Douglas Gregor | befc20e | 2009-03-26 00:10:35 +0000 | [diff] [blame] | 2 | template<typename T> |
| 3 | struct X { |
| 4 | X<T*> *ptr; |
| 5 | }; |
| 6 | |
| 7 | X<int> x; |
| 8 | |
| 9 | template<> |
| 10 | struct X<int***> { |
| 11 | typedef X<int***> *ptr; |
| 12 | }; |
| 13 | |
| 14 | // FIXME: EDG rejects this in their strict-conformance mode, but I |
Douglas Gregor | 7da97d0 | 2009-05-10 22:57:19 +0000 | [diff] [blame] | 15 | // don't see any wording making this ill-formed. Actually, |
| 16 | // [temp.local]p2 might make it ill-formed. Are we "in the scope of |
| 17 | // the class template specialization?" |
Douglas Gregor | befc20e | 2009-03-26 00:10:35 +0000 | [diff] [blame] | 18 | X<float>::X<int> xi = x; |
Douglas Gregor | 7da97d0 | 2009-05-10 22:57:19 +0000 | [diff] [blame] | 19 | |
| 20 | // [temp.local]p1: |
| 21 | |
Douglas Gregor | 828e226 | 2009-07-29 16:09:57 +0000 | [diff] [blame] | 22 | // FIXME: test template template parameters |
Douglas Gregor | 7da97d0 | 2009-05-10 22:57:19 +0000 | [diff] [blame] | 23 | template<typename T, typename U> |
| 24 | struct X0 { |
| 25 | typedef T type; |
| 26 | typedef U U_type; |
| 27 | typedef U_type U_type2; |
| 28 | |
| 29 | void f0(const X0&); // expected-note{{here}} |
| 30 | void f0(X0&); |
| 31 | void f0(const X0<T, U>&); // expected-error{{redecl}} |
| 32 | |
| 33 | void f1(const X0&); // expected-note{{here}} |
| 34 | void f1(X0&); |
| 35 | void f1(const X0<type, U_type2>&); // expected-error{{redecl}} |
| 36 | |
| 37 | void f2(const X0&); // expected-note{{here}} |
| 38 | void f2(X0&); |
| 39 | void f2(const ::X0<type, U_type2>&); // expected-error{{redecl}} |
| 40 | }; |
Douglas Gregor | 828e226 | 2009-07-29 16:09:57 +0000 | [diff] [blame] | 41 | |
| 42 | template<typename T, T N> |
| 43 | struct X1 { |
| 44 | void f0(const X1&); // expected-note{{here}} |
| 45 | void f0(X1&); |
| 46 | void f0(const X1<T, N>&); // expected-error{{redecl}} |
| 47 | }; |
| 48 | |