blob: 642a5767e841820f9be0ad44e038616d79833025 [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" }
}
int* bad2()
{
int x = 0;
return &x; // { dg-error "address of local variable" }
}
const int& bad4()
{
return int(); // { dg-error "returning reference to temporary" }
}