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