Home | History | Annotate | Download | only in temp.static
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 
      3 template<typename T>
      4 struct X0 {
      5   static T value;
      6 };
      7 
      8 template<typename T>
      9 T X0<T>::value = 0; // expected-error{{no viable conversion}}
     10 
     11 struct X1 {
     12   X1(int);
     13 };
     14 
     15 struct X2 { }; // expected-note{{candidate constructor (the implicit copy constructor) not viable}}
     16 
     17 int& get_int() { return X0<int>::value; }
     18 X1& get_X1() { return X0<X1>::value; }
     19 
     20 double*& get_double_ptr() { return X0<int*>::value; } // expected-error{{non-const lvalue reference to type 'double *' cannot bind to a value of unrelated type 'int *'}}
     21 
     22 X2& get_X2() {
     23   return X0<X2>::value; // expected-note{{instantiation}}
     24 }
     25 
     26 template<typename T> T x; // expected-error{{variable 'x' declared as a template}}
     27