Debian Codegraph @

gcc/testsuite/g++.dg/torture/pr34099.C

raw
1 /* { dg-do run } */
2 /* { dg-skip-if "requires hosted libstdc++ for complex" { ! hostedlib } } */
3
4 #include <complex>
5
6 typedef std::complex<double> NumType;
7
8 void
9 multiply(NumType a, NumType b, unsigned ac, NumType &ab)
10 {
11 NumType s;
12 for (unsigned j=0; j<ac; j++)
13 s = a * b;
14 ab = s;
15 }
16 extern "C" void abort (void);
17 int main()
18 {
19 NumType a(1,2), b(3,-2), c;
20 multiply(a, b, 1, c);
21 if (c.real() != 7
22 || c.imag() != 4)
23 abort ();
24 return 0;
25 }
26