Debian Codegraph @

gcc/testsuite/g++.dg/cpp23/ext-floating18.C

raw
1 // P1467R9 - Extended floating-point types and standard names.
2 // { dg-do compile { target c++23 } }
3 // { dg-options "" }
4 // { dg-add-options float32 }
5
6 constexpr int foo (float) { return 1; }
7 constexpr int foo (double) { return 2; }
8 constexpr int foo (long double) { return 3; }
9
10 #ifdef __STDCPP_FLOAT32_T__
11 #if __FLT_MAX_EXP__ == __FLT32_MAX_EXP__ \
12 && __FLT_MAX_DIG__ == __FLT32_MAX_DIG__
13 #if __FLT_MAX_EXP__ == __DBL_MAX_EXP__ \
14 && __FLT_MAX_DIG__ == __DBL_MAX_DIG__
15 static_assert (foo (1.0f32) == 2);
16 #else
17 static_assert (foo (1.0f32) == 1);
18 #endif
19 #endif
20 #endif
21 #ifdef __STDCPP_FLOAT64_T__
22 #if __DBL_MAX_EXP__ == __FLT64_MAX_EXP__ \
23 && __DBL_MAX_DIG__ == __FLT64_MAX_DIG__
24 static_assert (foo (1.0f64) == 2);
25 #endif
26 #endif