summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/cond1.C
blob: ae8fa4d45d9f7ee34f43debb4f38a7dc95ed41d3 (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
// { dg-do run }
// { dg-options "-O2" }

struct D { int x; };
struct W
{
  W () {}
  D & operator * () { return d; }
  D d;
};

int
foo (int y)
{
  W m;
  (*m).x = (y > 1 ? y : 0);
  return (*m).x;
}

int
main ()
{
  return (foo (6) != 6);
}