Debian Codegraph @

gcc/testsuite/g++.dg/cpp1z/eval-order10.C

raw
1 // PR c++/82959
2 // { dg-do run }
3 // { dg-additional-options -fstrong-eval-order }
4
5 struct A {};
6
7 void operator && (const A x, const A) {}
8 void operator || (const A x, const A) {}
9 void operator , (const A x, const A) {}
10
11 int i;
12
13 A f () { if (i != 0) __builtin_abort (); i = 1; return A (); }
14 A g () { if (i != 1) __builtin_abort (); i = 2; return A (); }
15
16 int
17 main ()
18 {
19 f () && g ();
20 if (i != 2) __builtin_abort ();
21 i = 0;
22 f () || g ();
23 if (i != 2) __builtin_abort ();
24 i = 0;
25 f (), g ();
26 if (i != 2) __builtin_abort ();
27 }