| 1 |
// { dg-do run } |
| 2 |
// { dg-skip-if "requires hosted libstdc++ for complex" { ! hostedlib } } |
| 3 |
|
| 4 |
#include <cstdlib> |
| 5 |
#include <complex> |
| 6 |
|
| 7 |
void __attribute__((noinline)) |
| 8 |
h(std::complex<double> x) |
| 9 |
{ |
| 10 |
if (x.real() != 2.0) |
| 11 |
std::abort (); |
| 12 |
} |
| 13 |
|
| 14 |
void __attribute__((noinline)) |
| 15 |
g(std::complex<double> x) |
| 16 |
{ |
| 17 |
if (x.real() != 0.5) |
| 18 |
std::abort (); |
| 19 |
} |
| 20 |
|
| 21 |
void __attribute__((noinline)) |
| 22 |
f(std::complex<double> x) |
| 23 |
{ |
| 24 |
h (x); |
| 25 |
x = 1.0 / x; |
| 26 |
g (x); |
| 27 |
} |
| 28 |
|
| 29 |
int main() |
| 30 |
{ |
| 31 |
f(2.0); |
| 32 |
return 0; |
| 33 |
} |