blob: 93a7231b8c7b7ac0c81a03930f881fc0904b0fd4 [file] [log] [blame]
Daniel Dunbar8fbe78f2009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Douglas Gregor97f1f1c2009-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
Richard Smith74f02342017-01-19 21:00:13 +000014X<float>::X<int> xi = x; // expected-error{{qualified reference to 'X' is a constructor name rather than a template name}}
15void f() {
16 X<float>::X<int> xi = x; // expected-error{{qualified reference to 'X' is a constructor name rather than a template name}}
17}
Douglas Gregore362cea2009-05-10 22:57:19 +000018
19// [temp.local]p1:
20
Douglas Gregor00044172009-07-29 16:09:57 +000021// FIXME: test template template parameters
Douglas Gregore362cea2009-05-10 22:57:19 +000022template<typename T, typename U>
23struct X0 {
24 typedef T type;
25 typedef U U_type;
26 typedef U_type U_type2;
27
28 void f0(const X0&); // expected-note{{here}}
29 void f0(X0&);
30 void f0(const X0<T, U>&); // expected-error{{redecl}}
31
32 void f1(const X0&); // expected-note{{here}}
33 void f1(X0&);
34 void f1(const X0<type, U_type2>&); // expected-error{{redecl}}
35
36 void f2(const X0&); // expected-note{{here}}
37 void f2(X0&);
38 void f2(const ::X0<type, U_type2>&); // expected-error{{redecl}}
39};
Douglas Gregor00044172009-07-29 16:09:57 +000040
41template<typename T, T N>
42struct X1 {
43 void f0(const X1&); // expected-note{{here}}
44 void f0(X1&);
45 void f0(const X1<T, N>&); // expected-error{{redecl}}
46};
47
John McCalle78aac42010-03-10 03:28:59 +000048namespace pr6326 {
49 template <class T> class A {
50 friend class A;
51 };
52 template class A<int>;
53}
Douglas Gregor1e13c5a2010-04-30 04:39:27 +000054
55namespace ForwardDecls {
56 template<typename T>
57 struct X;
58
59 template<typename T>
60 struct X {
61 typedef T foo;
62 typedef X<T> xt;
63 typename xt::foo *t;
64 };
65}
Richard Smith88fe69c2015-07-06 01:45:27 +000066
67namespace ConflictingRedecl {
68 template<typename> struct Nested {
69 template<typename> struct Nested; // expected-error {{member 'Nested' has the same name as its class}}
70 };
71}