gcc/testsuite/g++.dg/other/complex1.C
raw| 1 | // PR middle-end/18882 |
| 2 | // Origin: Petr Mikulik <[email protected]> |
| 3 | // Testcase by Wolfgang Bangerth <[email protected]> |
| 4 | |
| 5 | // { dg-do run } |
| 6 | // { dg-options "" } |
| 7 | |
| 8 | extern "C" void abort (); |
| 9 | |
| 10 | struct C { |
| 11 | __complex__ long double c; |
| 12 | }; |
| 13 | |
| 14 | void foo() |
| 15 | { |
| 16 | C x = {2+2i}; |
| 17 | |
| 18 | int n = 1; |
| 19 | C y = (n==1) ? x : (C){3+3i}; |
| 20 | if (__imag__ y.c != 2) |
| 21 | abort (); |
| 22 | } |
| 23 | |
| 24 | int main(void) |
| 25 | { |
| 26 | foo (); |
| 27 | return 0; |
| 28 | } |