gcc/testsuite/g++.dg/ext/stmtexpr25.C
raw| 1 | // PR c++/81073 |
| 2 | // { dg-options "" } |
| 3 | // { dg-do compile { target c++11 } } |
| 4 | // Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'. |
| 5 | |
| 6 | struct test { const int *addr; }; |
| 7 | |
| 8 | const test* setup() |
| 9 | { |
| 10 | static constexpr test atest = |
| 11 | { |
| 12 | ({ static const int inner = (throw 1, 1); &inner; }) // { dg-error "static" "" } |
| 13 | }; |
| 14 | |
| 15 | return &atest; |
| 16 | } |
| 17 | |
| 18 | int main(){} |