summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/nrv17.C
blob: 6248bca037af454f3eda98ce5e56a3e7cf67b060 (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
26
27
28
29
30
31
32
// { dg-do run }

#include <cstdlib>
#include <complex>

void __attribute__((noinline))
h(std::complex<double> x)
{
  if (x.real() != 2.0)
    std::abort ();
}

void __attribute__((noinline))
g(std::complex<double> x)
{
  if (x.real() != 0.5)
    std::abort ();
}

void __attribute__((noinline))
f(std::complex<double> x)
{
  h (x);
  x = 1.0 / x;
  g (x);
}

int main()
{
  f(2.0);
  return 0;
}