blob: 4c21d2585d32a0b3c943875eaa8fb21c15c66bcd [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Douglas Gregorbefc20e2009-03-26 00:10:35 +00002template<typename T>
3struct X {
4 X<T*> *ptr;
5};
6
7X<int> x;
8
9template<>
10struct X<int***> {
11 typedef X<int***> *ptr;
12};
13
Douglas Gregor0efc2c12010-01-13 17:31:36 +000014X<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}}
Douglas Gregor7da97d02009-05-10 22:57:19 +000015
16// [temp.local]p1:
17
Douglas Gregor828e2262009-07-29 16:09:57 +000018// FIXME: test template template parameters
Douglas Gregor7da97d02009-05-10 22:57:19 +000019template<typename T, typename U>
20struct 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};
Douglas Gregor828e2262009-07-29 16:09:57 +000037
38template<typename T, T N>
39struct 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
John McCall3cb0ebd2010-03-10 03:28:59 +000045namespace pr6326 {
46 template <class T> class A {
47 friend class A;
48 };
49 template class A<int>;
50}
Douglas Gregor9ffce212010-04-30 04:39:27 +000051
52namespace 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}