aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/warn/return-reference.C
blob: 83021900dbd7696d6b6737cae14979cb84791b83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// { dg-do compile }

const int* bar();

const int&
foo1()
{
  static int empty;
  const int* x = bar();
  return (x ? *x : empty);      // { dg-bogus ".*" "" { xfail *-*-* } }
}

const int&
foo2()
{
  static int empty;
  const int* x = bar();
  const int& r = (x ? *x : empty);
  return (r);
}