| 1 |
// PR c++/111272 |
| 2 |
// { dg-do compile { target c++14 } } |
| 3 |
// { dg-options "-Werror=invalid-constexpr -fno-implicit-constexpr" } |
| 4 |
// { dg-prune-output "some warnings being treated as errors" } |
| 5 |
|
| 6 |
struct Jam |
| 7 |
{ |
| 8 |
// constexpr // n.b. |
| 9 |
int ft() { return 42; } // { dg-message "declared here" } |
| 10 |
|
| 11 |
constexpr Jam() { ft(); } // { dg-error "call to non-.constexpr. function" } |
| 12 |
// { dg-message "declared here" "" { target c++20_down } .-1 } |
| 13 |
}; |
| 14 |
|
| 15 |
constexpr bool test() |
| 16 |
{ |
| 17 |
Jam j; // { dg-error "called in a constant expression" } |
| 18 |
return true; |
| 19 |
} |
| 20 |
|
| 21 |
static_assert(test(), ""); // { dg-error "non-constant condition" } |