diff options
Diffstat (limited to 'test/SemaTemplate/explicit-instantiation.cpp')
-rw-r--r-- | test/SemaTemplate/explicit-instantiation.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/test/SemaTemplate/explicit-instantiation.cpp b/test/SemaTemplate/explicit-instantiation.cpp index b9a4ad2..b04639f 100644 --- a/test/SemaTemplate/explicit-instantiation.cpp +++ b/test/SemaTemplate/explicit-instantiation.cpp @@ -14,19 +14,22 @@ struct X0 { T f0(T x) { return x + 1; // expected-error{{invalid operands}} } - T* f0(T*, T*); + T* f0(T*, T*) { return T(); } template<typename U> - T f0(T, U); + T f0(T, U) { return T(); } }; +template<typename T> +T X0<T>::value; // expected-error{{no matching constructor}} + template int X0<int>::value; struct NotDefaultConstructible { NotDefaultConstructible(int); }; -template NotDefaultConstructible X0<NotDefaultConstructible>::value; +template NotDefaultConstructible X0<NotDefaultConstructible>::value; // expected-note{{instantiation}} template int X0<int>::f0(int); template int* X0<int>::f0(int*, int*); @@ -43,11 +46,11 @@ template MemPtr X0<MemPtr>::f0(MemPtr); // expected-note{{requested here}} struct X2 { int f0(int); // expected-note{{refers here}} - template<typename T> T f1(T); - template<typename T> T* f1(T*); + template<typename T> T f1(T) { return T(); } + template<typename T> T* f1(T*) { return 0; } - template<typename T, typename U> void f2(T, U*); // expected-note{{candidate}} - template<typename T, typename U> void f2(T*, U); // expected-note{{candidate}} + template<typename T, typename U> void f2(T, U*) { } // expected-note{{candidate}} + template<typename T, typename U> void f2(T*, U) { } // expected-note{{candidate}} }; template int X2::f0(int); // expected-error{{not an instantiation}} @@ -57,12 +60,12 @@ template int *X2::f1(int *); // okay template void X2::f2(int *, int *); // expected-error{{ambiguous}} -template<typename T> void print_type(); +template<typename T> void print_type() { } template void print_type<int>(); template void print_type<float>(); -template<typename T> void print_type(T*); +template<typename T> void print_type(T*) { } template void print_type(int*); template void print_type<int>(float*); // expected-error{{does not refer}} |