Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.dg/warn/Wno-return-local-addr.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
rev | line source |
---|---|
111 | 1 // { dg-do assemble } |
2 // { dg-options "-Wno-return-local-addr" } | |
3 | |
4 int& bad1() | |
5 { | |
6 int x = 0; | |
7 return x; | |
8 } | |
9 | |
10 int* bad2() | |
11 { | |
12 int x = 0; | |
13 return &x; | |
14 } | |
15 | |
16 int f(); | |
17 | |
18 const int& bad3() | |
19 { | |
20 return f(); | |
21 } | |
22 | |
23 const int& bad4() | |
24 { | |
25 return int(); | |
26 } |