18fbe78f6SDaniel Dunbar // RUN: %clang_cc1 -fsyntax-only -verify %s 28f003d0fSDouglas Gregor f(T)38f003d0fSDouglas Gregortemplate<typename T> inline void f(T) { } 48f003d0fSDouglas Gregor template void f(int); // expected-note{{previous explicit instantiation}} 58f003d0fSDouglas Gregor template void f(int); // expected-error{{duplicate explicit instantiation}} 68f003d0fSDouglas Gregor 78f003d0fSDouglas Gregor template<typename T> 88f003d0fSDouglas Gregor struct X0 { 98f003d0fSDouglas Gregor union Inner { }; 108f003d0fSDouglas Gregor fX0118f003d0fSDouglas Gregor void f(T) { } 128f003d0fSDouglas Gregor 138f003d0fSDouglas Gregor static T value; 148f003d0fSDouglas Gregor }; 158f003d0fSDouglas Gregor 168f003d0fSDouglas Gregor template<typename T> 17*7555b6a4SDavid Blaikie T X0<T>::value = 3.14; // expected-warning{{implicit conversion from 'double' to 'int' changes value from 3.14 to 3}} 188f003d0fSDouglas Gregor 1909ffc9b4SDavid Blaikie template struct X0<int>; // expected-note{{previous explicit instantiation}} \ 2009ffc9b4SDavid Blaikie expected-note{{requested here}} 218f003d0fSDouglas Gregor template struct X0<int>; // expected-error{{duplicate explicit instantiation}} 228f003d0fSDouglas Gregor 238f003d0fSDouglas Gregor template void X0<float>::f(float); // expected-note{{previous explicit instantiation}} 248f003d0fSDouglas Gregor template void X0<float>::f(float); // expected-error{{duplicate explicit instantiation}} 258f003d0fSDouglas Gregor 268f003d0fSDouglas Gregor template union X0<float>::Inner; // expected-note{{previous explicit instantiation}} 278f003d0fSDouglas Gregor template union X0<float>::Inner; // expected-error{{duplicate explicit instantiation}} 288f003d0fSDouglas Gregor 298f003d0fSDouglas Gregor template float X0<float>::value; // expected-note{{previous explicit instantiation}} 308f003d0fSDouglas Gregor template float X0<float>::value; // expected-error{{duplicate explicit instantiation}} 311da22257SDouglas Gregor 321da22257SDouglas Gregor // Make sure that we don't get tricked by redeclarations of nested classes. 331da22257SDouglas Gregor namespace NestedClassRedecls { 341da22257SDouglas Gregor template<typename T> 351da22257SDouglas Gregor struct X { 361da22257SDouglas Gregor struct Nested; 371da22257SDouglas Gregor friend struct Nested; 381da22257SDouglas Gregor 391da22257SDouglas Gregor struct Nested { NestedNestedClassRedecls::X::Nested401da22257SDouglas Gregor Nested() {} 411da22257SDouglas Gregor } nested; 421da22257SDouglas Gregor }; 431da22257SDouglas Gregor 441da22257SDouglas Gregor X<int> xi; 451da22257SDouglas Gregor 461da22257SDouglas Gregor template struct X<int>; 471da22257SDouglas Gregor } 48