gcc/ChangeLog:
[official-gcc.git] / gcc / testsuite / g++.dg / warn / Wreturn-local-addr.C
blobfaa3a345440c8e939218591087a9f0e3ca9dc3ee
1 // { dg-do assemble  }
2 // { dg-options "-Werror=return-local-addr" }
3 // { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 }
5 int& bad1()
7   int x = 0;            // { dg-error "reference to local variable" }
8   return x;
11 int* bad2()
13   int x = 0;            // { dg-error "address of local variable" }
14   return &x;
17 const int& bad4()
19   return int();         // { dg-error "returning reference to temporary" }