| 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 | template<typename T> |
| 6 | struct X0 { |
| 7 | static T value; |
| 8 | }; |
| 9 | |
| 10 | template<typename T> |
| 11 | T X0<T>::value = 0; // expected-error{{no viable conversion}} |
| 12 | |
| 13 | struct X1 { |
| 14 | X1(int); |
| 15 | }; |
| 16 | |
| 17 | struct X2 { }; // expected-note{{candidate constructor (the implicit copy constructor) not viable}} |
| 18 | #if __cplusplus >= 201103L // C++11 or later |
| 19 | // expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}} |
| 20 | #endif |
| 21 | |
| 22 | int& get_int() { return X0<int>::value; } |
| 23 | X1& get_X1() { return X0<X1>::value; } |
| 24 | |
| 25 | 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 *'}} |
| 26 | |
| 27 | X2& get_X2() { |
| 28 | return X0<X2>::value; // expected-note{{instantiation}} |
| 29 | } |
| 30 | |
| 31 | template<typename T> T x; // expected-warning 0-1{{variable templates are a C++14 extension}} |
| 32 | |