| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify=expected,precxx17,precxx20 %std_cxx98-14 %s |
| 2 |
// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx17,precxx20 -std=c++17 %s |
| 3 |
// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx20 %std_cxx20- %s |
| 4 |
|
| 5 |
template<typename T, T Value> struct Constant; |
| 6 |
// FIXME: bad location precxx20-error@-1 {{a non-type template parameter cannot have type 'float'}} |
| 7 |
// expected-note@-2 {{template parameter is declared here}} |
| 8 |
// cxx20-note@-3 {{template parameter is declared here}} |
| 9 |
|
| 10 |
Constant<int, 5> *c1; |
| 11 |
|
| 12 |
int x; |
| 13 |
float f(int, double); |
| 14 |
|
| 15 |
Constant<int&, x> *c2; |
| 16 |
Constant<int*, &x> *c3; |
| 17 |
Constant<float (*)(int, double), f> *c4; |
| 18 |
Constant<float (*)(int, double), &f> *c5; |
| 19 |
|
| 20 |
Constant<float (*)(int, int), f> *c6; // precxx17-error {{non-type template argument of type 'float (int, double)' cannot be converted to a value of type 'float (*)(int, int)'}} \ |
| 21 |
cxx17-error {{value of type 'float (int, double)' is not implicitly convertible to 'float (*)(int, int)'}} \ |
| 22 |
cxx20-error {{value of type 'float (int, double)' is not implicitly convertible to 'float (*)(int, int)'}} |
| 23 |
|
| 24 |
Constant<float, 0> *c7; // precxx20-note {{while substituting}} \ |
| 25 |
cxx20-error {{conversion from 'int' to 'float' is not allowed in a converted constant expression}} |