| 1 |
/* Test C23 constexpr. Valid code, compilation tests, IEEE arithmetic. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-std=c23 -pedantic-errors" } */ |
| 4 |
/* { dg-add-options ieee } */ |
| 5 |
/* { dg-require-effective-target inff } */ |
| 6 |
|
| 7 |
constexpr float fi = __builtin_inf (); |
| 8 |
constexpr double di = __builtin_inff (); |
| 9 |
constexpr float fn = __builtin_nan (""); |
| 10 |
constexpr double dn = __builtin_nanf (""); |
| 11 |
constexpr float fns = __builtin_nansf (""); |
| 12 |
constexpr double dns = __builtin_nans (""); |
| 13 |
constexpr _Complex double cdns = __builtin_nans (""); |
| 14 |
|
| 15 |
void |
| 16 |
f0 (void) |
| 17 |
{ |
| 18 |
(constexpr float) { __builtin_inf () }; |
| 19 |
(constexpr double) { __builtin_inff () }; |
| 20 |
(constexpr float) { __builtin_nan ("") }; |
| 21 |
(constexpr double) { __builtin_nanf ("") }; |
| 22 |
(constexpr float) { __builtin_nansf ("") }; |
| 23 |
(constexpr double) { __builtin_nans ("") }; |
| 24 |
(constexpr _Complex double) { __builtin_nans ("") }; |
| 25 |
} |