summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/init/ref16.C
blob: 2d56395cb63921412d810cf6c4710cc6f71044bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// PR c++/35548
// { dg-do run }

int c;
struct A
{
  A() { ++c; }
  A(const A&) { ++c; }
  ~A() { --c; }
};

A f()
{
  return A();
}

int i;
const A* ap;
int main()
{
  const A& ar = i ? *ap : f();
  return (c == 0);
}