1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s 2*f4a2713aSLionel Sambuc template<typename T> 3*f4a2713aSLionel Sambuc struct X { 4*f4a2713aSLionel Sambuc X<T*> *ptr; 5*f4a2713aSLionel Sambuc }; 6*f4a2713aSLionel Sambuc 7*f4a2713aSLionel Sambuc X<int> x; 8*f4a2713aSLionel Sambuc 9*f4a2713aSLionel Sambuc template<> 10*f4a2713aSLionel Sambuc struct X<int***> { 11*f4a2713aSLionel Sambuc typedef X<int***> *ptr; 12*f4a2713aSLionel Sambuc }; 13*f4a2713aSLionel Sambuc 14*f4a2713aSLionel Sambuc 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*f4a2713aSLionel Sambuc 16*f4a2713aSLionel Sambuc // [temp.local]p1: 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambuc // FIXME: test template template parameters 19*f4a2713aSLionel Sambuc template<typename T, typename U> 20*f4a2713aSLionel Sambuc struct X0 { 21*f4a2713aSLionel Sambuc typedef T type; 22*f4a2713aSLionel Sambuc typedef U U_type; 23*f4a2713aSLionel Sambuc typedef U_type U_type2; 24*f4a2713aSLionel Sambuc 25*f4a2713aSLionel Sambuc void f0(const X0&); // expected-note{{here}} 26*f4a2713aSLionel Sambuc void f0(X0&); 27*f4a2713aSLionel Sambuc void f0(const X0<T, U>&); // expected-error{{redecl}} 28*f4a2713aSLionel Sambuc 29*f4a2713aSLionel Sambuc void f1(const X0&); // expected-note{{here}} 30*f4a2713aSLionel Sambuc void f1(X0&); 31*f4a2713aSLionel Sambuc void f1(const X0<type, U_type2>&); // expected-error{{redecl}} 32*f4a2713aSLionel Sambuc 33*f4a2713aSLionel Sambuc void f2(const X0&); // expected-note{{here}} 34*f4a2713aSLionel Sambuc void f2(X0&); 35*f4a2713aSLionel Sambuc void f2(const ::X0<type, U_type2>&); // expected-error{{redecl}} 36*f4a2713aSLionel Sambuc }; 37*f4a2713aSLionel Sambuc 38*f4a2713aSLionel Sambuc template<typename T, T N> 39*f4a2713aSLionel Sambuc struct X1 { 40*f4a2713aSLionel Sambuc void f0(const X1&); // expected-note{{here}} 41*f4a2713aSLionel Sambuc void f0(X1&); 42*f4a2713aSLionel Sambuc void f0(const X1<T, N>&); // expected-error{{redecl}} 43*f4a2713aSLionel Sambuc }; 44*f4a2713aSLionel Sambuc 45*f4a2713aSLionel Sambuc namespace pr6326 { 46*f4a2713aSLionel Sambuc template <class T> class A { 47*f4a2713aSLionel Sambuc friend class A; 48*f4a2713aSLionel Sambuc }; 49*f4a2713aSLionel Sambuc template class A<int>; 50*f4a2713aSLionel Sambuc } 51*f4a2713aSLionel Sambuc 52*f4a2713aSLionel Sambuc namespace ForwardDecls { 53*f4a2713aSLionel Sambuc template<typename T> 54*f4a2713aSLionel Sambuc struct X; 55*f4a2713aSLionel Sambuc 56*f4a2713aSLionel Sambuc template<typename T> 57*f4a2713aSLionel Sambuc struct X { 58*f4a2713aSLionel Sambuc typedef T foo; 59*f4a2713aSLionel Sambuc typedef X<T> xt; 60*f4a2713aSLionel Sambuc typename xt::foo *t; 61*f4a2713aSLionel Sambuc }; 62*f4a2713aSLionel Sambuc } 63