aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ext/cond3.C
blob: 6390dc4270bffb33eed896e57480e189c9b05a15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// PR c++/86184
// { dg-do run }
// { dg-options "" }

int j;
struct X {
  X() { j++; }
  operator bool() { return true; }
};

/* Only create X once.  */
bool b = X() ?: false;
bool b2 = X() ? X() : false;

int
main ()
{
  if (j != 3)
    __builtin_abort ();
}