aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/warn/Wreturn-local-addr-2.C
blob: c483601e6b23e866e21afb7dd2462f7122091e4a (plain)
1
2
3
4
5
6
7
8
9
10
11
// PR c++/44859

struct Base2 { int m_foo; };
struct Derived2 : public Base2 {};

const Base2& f8() { return Derived2(); } // { dg-warning "reference to temporary" }

struct foo { };
struct bar { foo base; };

const foo& f9() { return bar().base; } // { dg-warning "reference to temporary" }