| 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | template<class T1> |
| 3 | class A { |
| 4 | template<class T2> class B { |
| 5 | void mf(); |
| 6 | }; |
| 7 | }; |
| 8 | |
| 9 | template<> template<> class A<int>::B<double>; |
| 10 | template<> template<> void A<char>::B<char>::mf(); |
| 11 | |
| 12 | template<> void A<char>::B<int>::mf(); // expected-error{{requires 'template<>'}} |
| 13 | |
| 14 | namespace test1 { |
| 15 | template <class> class A { |
| 16 | static int foo; |
| 17 | static int bar; |
| 18 | }; |
| 19 | typedef A<int> AA; |
| 20 | |
| 21 | template <> int AA::foo = 0; |
| 22 | int AA::bar = 1; // expected-error {{template specialization requires 'template<>'}} |
| 23 | int A<float>::bar = 2; // expected-error {{template specialization requires 'template<>'}} |
| 24 | |
| 25 | template <> class A<double> { |
| 26 | public: |
| 27 | static int foo; |
| 28 | static int bar; |
| 29 | }; |
| 30 | |
| 31 | typedef A<double> AB; |
| 32 | template <> int AB::foo = 0; // expected-error{{extraneous 'template<>'}} |
| 33 | int AB::bar = 1; |
| 34 | } |
| 35 | |