Home | History | Annotate | Download | only in SemaTemplate
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      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 X<float>::X<int> xi = x; // expected-error{{qualified reference to 'X' is a constructor name rather than a template name wherever a constructor can be declared}}
     15 
     16 // [temp.local]p1:
     17 
     18 // FIXME: test template template parameters
     19 template<typename T, typename U>
     20 struct X0 {
     21   typedef T type;
     22   typedef U U_type;
     23   typedef U_type U_type2;
     24 
     25   void f0(const X0&); // expected-note{{here}}
     26   void f0(X0&);
     27   void f0(const X0<T, U>&); // expected-error{{redecl}}
     28 
     29   void f1(const X0&); // expected-note{{here}}
     30   void f1(X0&);
     31   void f1(const X0<type, U_type2>&); // expected-error{{redecl}}
     32 
     33   void f2(const X0&); // expected-note{{here}}
     34   void f2(X0&);
     35   void f2(const ::X0<type, U_type2>&); // expected-error{{redecl}}
     36 };
     37 
     38 template<typename T, T N>
     39 struct X1 {
     40   void f0(const X1&); // expected-note{{here}}
     41   void f0(X1&);
     42   void f0(const X1<T, N>&); // expected-error{{redecl}}
     43 };
     44 
     45 namespace pr6326 {
     46   template <class T> class A {
     47     friend class A;
     48   };
     49   template class A<int>;
     50 }
     51 
     52 namespace ForwardDecls {
     53   template<typename T>
     54   struct X;
     55 
     56   template<typename T>
     57   struct X {
     58     typedef T foo;
     59     typedef X<T> xt;
     60     typename xt::foo *t;
     61   };
     62 }
     63