| 1 |
// P1467R9 - Extended floating-point types and standard names. |
| 2 |
// { dg-do compile { target c++23 } } |
| 3 |
// { dg-options "" } |
| 4 |
|
| 5 |
#include "ext-floating.h" |
| 6 |
|
| 7 |
#ifdef __STRICT_ANSI__ |
| 8 |
#undef __SIZEOF_FLOAT128__ |
| 9 |
#endif |
| 10 |
|
| 11 |
extern "C" void abort (); |
| 12 |
|
| 13 |
using namespace std; |
| 14 |
|
| 15 |
template <typename T, typename U> |
| 16 |
int |
| 17 |
foo (T x, U y) noexcept |
| 18 |
{ |
| 19 |
return 3; |
| 20 |
} |
| 21 |
|
| 22 |
int |
| 23 |
main () |
| 24 |
{ |
| 25 |
if (foo (0.0f, 0.0f) != 3) |
| 26 |
abort (); |
| 27 |
if (foo (0.0, 0.0) != 3) |
| 28 |
abort (); |
| 29 |
if (foo (0.0L, 0.0L) != 3) |
| 30 |
abort (); |
| 31 |
#ifdef __STDCPP_FLOAT16_T__ |
| 32 |
if (foo (0.0f16, 0.0f16) != 3) |
| 33 |
abort (); |
| 34 |
if (foo (0.0f, 0.0f16) != 3) |
| 35 |
abort (); |
| 36 |
#endif |
| 37 |
#ifdef __STDCPP_FLOAT32_T__ |
| 38 |
if (foo (0.0f32, 0.0f32) != 3) |
| 39 |
abort (); |
| 40 |
if (foo (0.0f, 0.0f32) != 3) |
| 41 |
abort (); |
| 42 |
#endif |
| 43 |
#ifdef __STDCPP_FLOAT64_T__ |
| 44 |
if (foo (0.0f64, 0.0f64) != 3) |
| 45 |
abort (); |
| 46 |
if (foo (0.0, 0.0f64) != 3) |
| 47 |
abort (); |
| 48 |
#endif |
| 49 |
#ifdef __STDCPP_FLOAT128_T__ |
| 50 |
if (foo (0.0f128, 0.0f128) != 3) |
| 51 |
abort (); |
| 52 |
if (foo (0.0L, 0.0f128) != 3) |
| 53 |
abort (); |
| 54 |
#endif |
| 55 |
#ifdef __STDCPP_BFLOAT16_T__ |
| 56 |
if (foo (0.0bf16, 0.0bf16) != 3) |
| 57 |
abort (); |
| 58 |
if (foo (0.0f, 0.0bf16) != 3) |
| 59 |
abort (); |
| 60 |
#endif |
| 61 |
#ifdef __FLT32X_MANT_DIG__ |
| 62 |
if (foo (0.0f32x, 0.0f32x) != 3) |
| 63 |
abort (); |
| 64 |
if (foo (0.0, 0.0f32x) != 3) |
| 65 |
abort (); |
| 66 |
#endif |
| 67 |
#ifdef __FLT64X_MANT_DIG__ |
| 68 |
if (foo (0.0f64x, 0.0f64x) != 3) |
| 69 |
abort (); |
| 70 |
if (foo (0.0L, 0.0f64x) != 3) |
| 71 |
abort (); |
| 72 |
#endif |
| 73 |
#ifdef __FLT128X_MANT_DIG__ |
| 74 |
if (foo (0.0f128x, 0.0f128x) != 3) |
| 75 |
abort (); |
| 76 |
if (foo (0.0L, 0.0f128x) != 3) |
| 77 |
abort (); |
| 78 |
#endif |
| 79 |
} |