1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 template void *; // expected-error{{expected unqualified-id}}
5 template typedef void f0; // expected-error{{explicit instantiation of typedef}}
7 int v0; // expected-note{{refers here}}
8 template int v0; // expected-error{{does not refer}}
15 return x + 1; // expected-error{{invalid operands}}
17 T* f0(T*, T*) { return T(); }
20 T f0(T, U) { return T(); }
24 T X0<T>::value; // expected-error{{no matching constructor}}
26 template int X0<int>::value;
28 struct NotDefaultConstructible { // expected-note{{candidate constructor (the implicit copy constructor)}}
29 NotDefaultConstructible(int); // expected-note{{candidate constructor}}
32 template NotDefaultConstructible X0<NotDefaultConstructible>::value; // expected-note{{instantiation}}
34 template int X0<int>::f0(int);
35 template int* X0<int>::f0(int*, int*);
36 template int X0<int>::f0(int, float);
38 template int X0<int>::f0(int) const; // expected-error{{does not refer}}
39 template int* X0<int>::f0(int*, float*); // expected-error{{does not refer}}
42 typedef int X1::*MemPtr;
44 template MemPtr X0<MemPtr>::f0(MemPtr); // expected-note{{requested here}}
47 int f0(int); // expected-note{{refers here}}
49 template<typename T> T f1(T) { return T(); }
50 template<typename T> T* f1(T*) { return 0; }
52 template<typename T, typename U> void f2(T, U*) { } // expected-note{{candidate}}
53 template<typename T, typename U> void f2(T*, U) { } // expected-note{{candidate}}
56 template int X2::f0(int); // expected-error{{not an instantiation}}
58 template int *X2::f1(int *); // okay
60 template void X2::f2(int *, int *); // expected-error{{ambiguous}}
63 template<typename T> void print_type() { }
65 template void print_type<int>();
66 template void print_type<float>();
68 template<typename T> void print_type(T*) { }
70 template void print_type(int*);
71 template void print_type<int>(float*); // expected-error{{does not refer}}
73 void print_type(double*);
74 template void print_type<double>(double*);
77 template<int I> void foo0 (int (&)[I + 1]) { }
78 template void foo0<2> (int (&)[3]);
80 namespace explicit_instantiation_after_implicit_instantiation {
81 template <int I> struct X0 { static int x; };
82 template <int I> int X0<I>::x;
83 void test1() { (void)&X0<1>::x; }
84 template struct X0<1>;