gcc/testsuite/g++.dg/ext/cond2.C
raw| 1 | // PR c++/70744 |
| 2 | // { dg-do run } |
| 3 | // { dg-options "" } |
| 4 | |
| 5 | static void |
| 6 | fn1 (void) |
| 7 | { |
| 8 | int x = 2; |
| 9 | ++x ? : 42; |
| 10 | if (x != 3) |
| 11 | __builtin_abort (); |
| 12 | --x ? : 42; |
| 13 | if (x != 2) |
| 14 | __builtin_abort (); |
| 15 | x++ ? : 42; |
| 16 | if (x != 3) |
| 17 | __builtin_abort (); |
| 18 | x-- ? : 42; |
| 19 | if (x != 2) |
| 20 | __builtin_abort (); |
| 21 | } |
| 22 | |
| 23 | int |
| 24 | main () |
| 25 | { |
| 26 | fn1 (); |
| 27 | return 0; |
| 28 | } |