1 // PR c++/77591 2 // { dg-do compile { target c++14 } } 3 // { dg-options "-O0 -Wreturn-local-addr" } 4 5 class A { }; 6 7 decltype(auto) foo()8foo () 9 { 10 A c; 11 return (c); // { dg-warning "reference to local variable 'c' returned" } 12 } 13 14 decltype(auto) bar()15bar () 16 { 17 A c; 18 return 1==1 ? c : c; // { dg-warning "reference to local variable 'c' returned" } 19 } 20