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
get_int()17 int& get_int() { return X0<int>::value; }
get_X1()18 X1& get_X1() { return X0<X1>::value; }
19
get_double_ptr()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
get_X2()22 X2& get_X2() {
23 return X0<X2>::value; // expected-note{{instantiation}}
24 }
25
26 template<typename T> T x; // expected-warning{{variable templates are a C++14 extension}}
27