Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.dg/warn/return-reference.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 compile } |
2 | |
3 const int* bar(); | |
4 | |
5 const int& | |
6 foo1() | |
7 { | |
8 static int empty; | |
9 const int* x = bar(); | |
10 return (x ? *x : empty); // { dg-bogus ".*" } | |
11 } | |
12 | |
13 const int& | |
14 foo2() | |
15 { | |
16 static int empty; | |
17 const int* x = bar(); | |
18 const int& r = (x ? *x : empty); | |
19 return (r); | |
20 } | |
21 |