blob: 4c18c2f06a040be44160a5d3261b342fc1fa6d80 [file] [log] [blame]
// { dg-do assemble }
// { dg-options "-Werror=return-local-addr" }
// { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 }
int& bad1()
{
int x = 0;
return x; // { dg-error "reference to local variable|cannot bind non-const lvalue reference" }
}
int* bad2()
{
int x = 0;
return &x; // { dg-error "address of local variable" }
}
const int& bad4()
{
return int(); // { dg-error "returning reference to temporary" }
}