aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/opt/pr51596.C
blob: 2ed94812de3b05aa0f9e7e9add8b5e4f6d76e7dd (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
33
34
35
36
37
38
39
// PR tree-optimization/51596
// { dg-do compile }
// { dg-options "-O -fnon-call-exceptions" }

struct A { float v[2]; };
struct B { int v[2]; };

struct C
{
  B c;
  C f ()
  {
    B b;
    for (int i = 0; i < 2; i++)
      b.v[i] = c.v[i];
    return *this;
  }
};

struct D
{
  A d;
  D (B x)
  {
    for (int i = 0; i < 2; i++)
      d.v[i] = x.v[i];
  }
};

int bar ();

C i;

void
foo ()
{
  while (bar ())
    D (i.f ().c);
}