gcc/testsuite/g++.dg/cpp23/constexpr-nonlit13.C
raw| 1 | // PR c++/106649 |
| 2 | // P2448 - Relaxing some constexpr restrictions |
| 3 | // { dg-do compile { target c++23 } } |
| 4 | // { dg-options "-Winvalid-constexpr" } |
| 5 | |
| 6 | constexpr volatile int i = 10; |
| 7 | |
| 8 | constexpr int |
| 9 | bar () |
| 10 | { |
| 11 | return i; // { dg-warning "lvalue-to-rvalue conversion of a volatile lvalue" } |
| 12 | } |
| 13 | |
| 14 | constexpr int x = bar (); // { dg-error "called in a constant expression" } |