From: Wolfgang Bangerth Date: Thu, 16 Dec 2004 10:16:24 +0000 (+0000) Subject: * g++.dg/other/complex1.C: New test. X-Git-Tag: releases/gcc-4.0.0~2122 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0c0cce420e1ced4cfd4e6daddb91e3f6b548bf29;p=thirdparty%2Fgcc.git * g++.dg/other/complex1.C: New test. From-SVN: r92254 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 06dd868513a0..c70c52627147 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-12-16 Wolfgang Bangerth + + * g++.dg/other/complex1.C: New test. + 2004-12-15 Alan Modra * g++.dg/opt/inline9.C: New test. diff --git a/gcc/testsuite/g++.dg/other/complex1.C b/gcc/testsuite/g++.dg/other/complex1.C new file mode 100644 index 000000000000..5c0351428512 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/complex1.C @@ -0,0 +1,28 @@ +// PR middle-end/18882 +// Origin: Petr Mikulik +// Testcase by Wolfgang Bangerth + +// { dg-do run } +// { dg-options "" } + +extern "C" void abort (); + +struct C { + __complex__ long double c; +}; + +void foo() +{ + C x = {2+2i}; + + int n = 1; + C y = (n==1) ? x : (C){3+3i}; + if (__imag__ y.c != 2) + abort (); +} + +int main(void) +{ + foo (); + return 0; +}