summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/pr19317-2.C
blob: 70c642b219dd15089396e2da0a4b7bf61eb2209d (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
25
26
27
28
29
30
31
32
// PR c++/19317
// { dg-options "-O2" }
// { dg-do run }

extern "C" void abort (void);

struct A
{
  A () { d = e = 0; f = -1; }
  A (int x) : d (0), e (0), f (x) { }
  A b () const;
  int d;
  int e;
  int f;
};

A
A::b () const
{
  A t;
  t.f = 10 + this->f;
  return t;
}

int
main ()
{
  A a (100);
  a = a.b ();
  if (a.f != 110)
    abort ();
}