gcc/testsuite/g++.dg/parse/crash78a.C
raw| 1 | // PR c++/117099 |
| 2 | // With -fpermissive, make sure we don't do NRV in this case, but keep |
| 3 | // executing fine. Note that the return at line 16 is undefined behaviour. |
| 4 | // { dg-do "run" } |
| 5 | // { dg-options "-fpermissive" } |
| 6 | |
| 7 | struct X { |
| 8 | ~X() {} |
| 9 | }; |
| 10 | |
| 11 | X test(bool b) { |
| 12 | X x; |
| 13 | if (b) |
| 14 | return x; |
| 15 | else |
| 16 | return; // { dg-warning "return-statement with no value" } |
| 17 | } |
| 18 | |
| 19 | int main(int, char*[]) { |
| 20 | (void) test (false); |
| 21 | return 0; |
| 22 | } |