summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/nrv3.C
blob: 2ec597744695c5701e076d75174b5ae4de4ec7f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// PR optimization/6189
// Bug: we forgot about foo's nrv after writing it out.
// { dg-options -O3 }
// { dg-do run }

struct A
{
  int i;
};


A foo ()
{
  A a;
  a.i = 42;
  return a;
}


int main()
{
  A b = foo();
  return b.i != 42;
}