Debian Codegraph @

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

raw
1 // P1467R9 - Extended floating-point types and standard names.
2 // { dg-do compile { target c++23 } }
3 // { dg-options "-Werror=narrowing" }
4 // { dg-add-options float16 }
5 // { dg-add-options float32 }
6 // { dg-add-options float64 }
7 // { dg-add-options float128 }
8 // { dg-prune-output "some warnings being treated as errors" }
9
10 #include "ext-floating.h"
11
12 #ifdef __STRICT_ANSI__
13 #undef __SIZEOF_FLOAT128__
14 #endif
15
16 using namespace std;
17
18 #ifdef __STDCPP_FLOAT16_T__
19 #ifdef __STDCPP_FLOAT32_T__
20 float16_t f16c = 1.0F32; // { dg-error "converting to 'std::float16_t' \\\{aka '_Float16'\\\} from '_Float32' with greater conversion rank" "" { target { float16 && float32 } } }
21 #endif
22 #ifdef __STDCPP_FLOAT64_T__
23 float16_t f16e = 1.0F64; // { dg-error "converting to 'std::float16_t' \\\{aka '_Float16'\\\} from '_Float64' with greater conversion rank" "" { target { float16 && float64 } } }
24 #endif
25 #ifdef __STDCPP_FLOAT128_T__
26 float16_t f16g = 1.0F128; // { dg-error "converting to 'std::float16_t' \\\{aka '_Float16'\\\} from '_Float128' with greater conversion rank" "" { target { float16 && float128 } } }
27 #endif
28 #endif
29 #ifdef __STDCPP_FLOAT32_T__
30 #ifdef __STDCPP_FLOAT64_T__
31 float32_t f32e = 1.0F64; // { dg-error "converting to 'std::float32_t' \\\{aka '_Float32'\\\} from '_Float64' with greater conversion rank" "" { target { float32 && float64 } } }
32 #endif
33 #ifdef __STDCPP_FLOAT128_T__
34 float32_t f32g = 1.0F128; // { dg-error "converting to 'std::float32_t' \\\{aka '_Float32'\\\} from '_Float128' with greater conversion rank" "" { target { float32 && float128 } } }
35 #endif
36 #endif
37 #ifdef __STDCPP_FLOAT64_T__
38 #ifdef __STDCPP_FLOAT128_T__
39 float64_t f64g = 1.0F128; // { dg-error "converting to 'std::float64_t' \\\{aka '_Float64'\\\} from '_Float128' with greater conversion rank" "" { target { float64 && float128 } } }
40 #endif
41 #endif
42