diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/torture/pr34099.C')
-rw-r--r-- | gcc/testsuite/g++.dg/torture/pr34099.C | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/torture/pr34099.C b/gcc/testsuite/g++.dg/torture/pr34099.C new file mode 100644 index 000000000..49fa9cac1 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr34099.C @@ -0,0 +1,25 @@ +/* { dg-do run } */ + +#include <complex> + +typedef std::complex<double> NumType; + +void +multiply(NumType a, NumType b, unsigned ac, NumType &ab) +{ + NumType s; + for (unsigned j=0; j<ac; j++) + s = a * b; + ab = s; +} +extern "C" void abort (void); +int main() +{ + NumType a(1,2), b(3,-2), c; + multiply(a, b, 1, c); + if (c.real() != 7 + || c.imag() != 4) + abort (); + return 0; +} + |