1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 3 template<typename T> inline void f(T) { } 4 template void f(int); // expected-note{{previous explicit instantiation}} 5 template void f(int); // expected-error{{duplicate explicit instantiation}} 6 7 template<typename T> 8 struct X0 { 9 union Inner { }; 10 11 void f(T) { } 12 13 static T value; 14 }; 15 16 template<typename T> 17 T X0<T>::value = 3.14; 18 19 template struct X0<int>; // expected-note{{previous explicit instantiation}} 20 template struct X0<int>; // expected-error{{duplicate explicit instantiation}} 21 22 template void X0<float>::f(float); // expected-note{{previous explicit instantiation}} 23 template void X0<float>::f(float); // expected-error{{duplicate explicit instantiation}} 24 25 template union X0<float>::Inner; // expected-note{{previous explicit instantiation}} 26 template union X0<float>::Inner; // expected-error{{duplicate explicit instantiation}} 27 28 template float X0<float>::value; // expected-note{{previous explicit instantiation}} 29 template float X0<float>::value; // expected-error{{duplicate explicit instantiation}} 30 31 // Make sure that we don't get tricked by redeclarations of nested classes. 32 namespace NestedClassRedecls { 33 template<typename T> 34 struct X { 35 struct Nested; 36 friend struct Nested; 37 38 struct Nested { 39 Nested() {} 40 } nested; 41 }; 42 43 X<int> xi; 44 45 template struct X<int>; 46 } 47