gcc/testsuite/g++.dg/cpp1y/constexpr-diag2.C
raw| 1 | // PR c++/113360 |
| 2 | // { dg-do compile { target c++14 } } |
| 3 | |
| 4 | constexpr bool init_list() // { dg-bogus "because" } |
| 5 | { |
| 6 | int total{}; |
| 7 | for (int x : {1, 2, 3}) // { dg-error "initializer list" } |
| 8 | total += x; |
| 9 | return total == 6; |
| 10 | } |
| 11 | |
| 12 | static_assert(init_list(), ""); // { dg-error "constant" } |