brintos

brintos / llvm-project-archived public Read only

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