1// RUN: %clang_cc1 -fsyntax-only -verify %s 2 3struct IntHolder { // expected-note{{here}} // expected-note 2{{candidate constructor (the implicit copy constructor)}} 4 IntHolder(int); // expected-note 2{{candidate constructor}} 5}; 6 7template<typename T, typename U> 8struct X { // expected-note{{here}} 9 void f() { 10 T t; // expected-error{{no matching}} 11 } 12 13 void g() { } 14 15 struct Inner { // expected-error{{implicit default}} 16 T value; // expected-note {{member is declared here}} 17 }; 18 19 static T value; 20}; 21 22template<typename T, typename U> 23T X<T, U>::value; // expected-error{{no matching constructor}} 24 25IntHolder &test_X_IntHolderInt(X<IntHolder, int> xih) { 26 xih.g(); // okay 27 xih.f(); // expected-note{{instantiation}} 28 29 X<IntHolder, int>::Inner inner; // expected-note {{first required here}} 30 31 return X<IntHolder, int>::value; // expected-note{{instantiation}} 32} 33 34// Explicitly specialize the members of X<IntHolder, long> to not cause 35// problems with instantiation. 36template<> 37void X<IntHolder, long>::f() { } 38 39template<> 40struct X<IntHolder, long>::Inner { 41 Inner() : value(17) { } 42 IntHolder value; 43}; 44 45template<> 46IntHolder X<IntHolder, long>::value = 17; 47 48IntHolder &test_X_IntHolderInt(X<IntHolder, long> xih) { 49 xih.g(); // okay 50 xih.f(); // okay, uses specialization 51 52 X<IntHolder, long>::Inner inner; // okay, uses specialization 53 54 return X<IntHolder, long>::value; // okay, uses specialization 55} 56 57template<> 58X<IntHolder, long>::X() { } // expected-error{{instantiated member}} 59