| 1 |
// RUN: %clang_cc1 -std=c++2a -fsyntax-only -fcxx-exceptions -verify=ref,both %s |
| 2 |
// RUN: %clang_cc1 -std=c++2a -fsyntax-only -fcxx-exceptions -verify=expected,both %s -fexperimental-new-constant-interpreter |
| 3 |
|
| 4 |
template <unsigned N> |
| 5 |
struct S { |
| 6 |
S() requires (N==1) = default; |
| 7 |
S() requires (N==2) {} // both-note {{declared here}} |
| 8 |
consteval S() requires (N==3) = default; |
| 9 |
}; |
| 10 |
|
| 11 |
consteval int aConstevalFunction() { // both-error {{consteval function never produces a constant expression}} |
| 12 |
S<2> s4; // both-note {{non-constexpr constructor 'S' cannot be used in a constant expression}} |
| 13 |
return 0; |
| 14 |
} |
| 15 |
/// We're NOT calling the above function. The diagnostics should appear anyway. |