aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34099.C
blob: 49fa9cac1ebc1d5454028208ef8977ff6f6526c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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;
}