gcc/testsuite/g++.dg/warn/Wunused-5.C
raw| 1 | /* PR opt/14288 */ |
| 2 | /* { dg-do compile } */ |
| 3 | /* { dg-options "-O -Wall" } */ |
| 4 | |
| 5 | volatile int sink; |
| 6 | extern int foo(int); |
| 7 | |
| 8 | struct S |
| 9 | { |
| 10 | int x; |
| 11 | |
| 12 | S() { x = foo(0); } |
| 13 | ~S() { sink = x; } |
| 14 | }; |
| 15 | |
| 16 | int test(bool p) |
| 17 | { |
| 18 | return p ? foo(S().x) : 0; /* { dg-bogus "uninitialized" } */ |
| 19 | } |