Home | History | Annotate | Download | only in temp.expl.spec
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 template<class T> struct A {
      3        struct B { };
      4        template<class U> struct C { };
      5 };
      6      template<> struct A<int> {
      7        void f(int);
      8 };
      9 void h() {
     10   A<int> a;
     11   a.f(16);
     12 }
     13 // A<int>::f must be defined somewhere
     14 // template<> not used for a member of an // explicitly specialized class template
     15 void A<int>::f(int) { /* ... */ }
     16   template<> struct A<char>::B {
     17     void f();
     18 };
     19 // template<> also not used when defining a member of // an explicitly specialized member class
     20 void A<char>::B::f() { /* ... */ }
     21   template<> template<class U> struct A<char>::C {
     22     void f();
     23 };
     24 
     25 template<>
     26 template<class U> void A<char>::C<U>::f() { /* ... */ }
     27   template<> struct A<short>::B {
     28     void f();
     29 };
     30 template<> void A<short>::B::f() { /* ... */ } // expected-error{{no function template matches function template specialization 'f'}}
     31   template<> template<class U> struct A<short>::C {
     32     void f();
     33 };
     34 template<class U> void A<short>::C<U>::f() { /* ... */ } // expected-error{{template parameter list matching the non-templated nested type 'A<short>' should be empty ('template<>')}}
     35