gcc/testsuite/g++.dg/warn/ref-temp1.C
raw| 1 | // PR c++/986 |
| 2 | // { dg-options "-Wall -Wextra" } |
| 3 | |
| 4 | struct X { X (int); }; |
| 5 | |
| 6 | struct Y { |
| 7 | Y (); |
| 8 | const X &x; // note the ampersand |
| 9 | }; |
| 10 | |
| 11 | Y::Y () : x(1) {} // { dg-warning "temporary" } |
| 12 | |
| 13 | /* The initialization of x with the temporary might also trigger: |
| 14 | { dg-prune-output "-Wdangling-pointer" } */ |