summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/overload/cond1.C
blob: 74f0f3c49e3a2dd0858040a627050d6b79eff3ef (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
// Test that converting a COND_EXPR to void doesn't result in trying to
// bitwise copy a class with a nontrivial copy constructor (and thus a
// compiler abort).

// { dg-options "-O" }

struct A {
  virtual ~A() { }
};

A a1, a2;
inline A& one () { return a1; }
inline A& two () { return a2; }

inline void f (int i)
{
  i ? a1 : a2;
  i ? one() : two();
}

int main ()
{
  f (1);
}