aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ext/cond4.C
blob: 86993306aa5063fe6e411c29612a8f489466b7d2 (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
// PR c++/93046
// { dg-do run }
// { dg-options "" }

int c;

struct S {
  int i;
  S (int i) : i(i) { ++c; }
  S (const S &s): i(s.i) { ++c; }
  operator bool () { return i; }
};

S
foo ()
{
  return S (1) ? : S (2);
}

int main()
{
  S s = foo();
  if (s.i != 1 || c != 2)
    __builtin_abort ();
}