blob: 07994f97d3f618a047ab74336dfc8d8aedfbca4a [file] [log] [blame]
Douglas Gregord5a423b2009-09-25 18:43:00 +00001// RUN: clang-cc -fsyntax-only -verify %s
2
3template void *; // expected-error{{expected unqualified-id}}
4
5template typedef void f0; // expected-error{{explicit instantiation of typedef}}
6
7int v0; // expected-note{{refers here}}
8template int v0; // expected-error{{does not refer}}
9
10template<typename T>
11struct X0 {
12 static T value;
13
14 T f0(T x) {
15 return x + 1; // expected-error{{invalid operands}}
16 }
17 T* f0(T*, T*);
18
19 template<typename U>
20 T f0(T, U);
21};
22
23template int X0<int>::value;
24
25struct NotDefaultConstructible {
26 NotDefaultConstructible(int);
27};
28
29template NotDefaultConstructible X0<NotDefaultConstructible>::value;
30
31template int X0<int>::f0(int);
32template int* X0<int>::f0(int*, int*);
33template int X0<int>::f0(int, float);
34
35template int X0<int>::f0(int) const; // expected-error{{does not refer}}
36template int* X0<int>::f0(int*, float*); // expected-error{{does not refer}}
37
38struct X1 { };
39typedef int X1::*MemPtr;
40
41template MemPtr X0<MemPtr>::f0(MemPtr); // expected-note{{requested here}}
42
43struct X2 {
44 int f0(int); // expected-note{{refers here}}
45
46 template<typename T> T f1(T);
47 template<typename T> T* f1(T*);
48
49 template<typename T, typename U> void f2(T, U*); // expected-note{{candidate}}
50 template<typename T, typename U> void f2(T*, U); // expected-note{{candidate}}
51};
52
53template int X2::f0(int); // expected-error{{not an instantiation}}
54
55template int *X2::f1(int *); // okay
56
57template void X2::f2(int *, int *); // expected-error{{ambiguous}}
Douglas Gregordb422df2009-09-25 21:45:23 +000058
59
60template<typename T> void print_type();
61
62template void print_type<int>();
63template void print_type<float>();
64
65template<typename T> void print_type(T*);
66
67template void print_type(int*);
68template void print_type<int>(float*); // expected-error{{does not refer}}
69
70void print_type(double*);
71template void print_type<double>(double*);