gcc/testsuite/g++.dg/warn/Wreturn-local-addr-2.C
raw| 1 | // PR c++/44859 |
| 2 | |
| 3 | struct Base2 { int m_foo; }; |
| 4 | struct Derived2 : public Base2 {}; |
| 5 | |
| 6 | const Base2& f8() { return Derived2(); } // { dg-message "reference to temporary" } |
| 7 | |
| 8 | struct foo { }; |
| 9 | struct bar { foo base; }; |
| 10 | |
| 11 | const foo& f9() { return bar().base; } // { dg-message "reference to temporary" } |