1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 3 // Test instantiation of static data members declared out-of-line. 4 5 template<typename T> 6 struct X { 7 static T value; 8 }; 9 10 template<typename T> 11 T X<T>::value = 17; // expected-error{{no viable conversion}} 12 13 struct InitOkay { InitOkayInitOkay14 InitOkay(int) { } 15 }; 16 17 struct CannotInit { }; // expected-note{{candidate constructor (the implicit copy constructor) not viable}} 18 returnInt()19int &returnInt() { return X<int>::value; } returnFloat()20float &returnFloat() { return X<float>::value; } 21 returnInitOkay()22InitOkay &returnInitOkay() { return X<InitOkay>::value; } 23 sizeOkay()24unsigned long sizeOkay() { return sizeof(X<CannotInit>::value); } 25 returnError()26CannotInit &returnError() { 27 return X<CannotInit>::value; // expected-note{{instantiation}} 28 } 29