Debian Codegraph @

gcc/testsuite/g++.dg/ext/cond4.C

raw
1 // PR c++/93046
2 // { dg-do run }
3 // { dg-options "" }
4
5 int c;
6
7 struct S {
8 int i;
9 S (int i) : i(i) { ++c; }
10 S (const S &s): i(s.i) { ++c; }
11 operator bool () { return i; }
12 };
13
14 S
15 foo ()
16 {
17 return S (1) ? : S (2);
18 }
19
20 int main()
21 {
22 S s = foo();
23 if (s.i != 1 || c != 2)
24 __builtin_abort ();
25 }