-
- Downloads
c: Update checks on constexpr floating-point initializers
WG14 has agreed some changes (detailed at the end of N3082) to the rules on constexpr initializers for floating types. Update GCC's implementation to match: binary initializers are now allowed for decimal types, and real initializers for complex types, but signaling NaN initializers can't be used for a different type with the same mode. There are also changes to the constexpr rules for pointer types (allowing null pointer address constants that aren't null pointer constants), which I'll deal with separately. Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/c/ * c-typeck.cc: Include "realmpfr.h". (constexpr_init_fits_real_type): Do not allow signaling NaN conversions to different types with the same mode. Handle conversions from binary to decimal types. (check_constexpr_init): Do not disallow real initializers for complex types. Do not disallow binary initializers for decimal floating types. gcc/testsuite/ * gcc.dg/c2x-constexpr-1.c: Test constexpr initializers of complex types with real initializers are allowed. * gcc.dg/c2x-constexpr-3.c: Do not test for constexpr initializers of complex types with real initializers being disallowed. * gcc.dg/c2x-constexpr-8.c: Add tests of signaling NaN complex initializers. * gcc.dg/c2x-constexpr-9.c: Add more tests. * gcc.dg/dfp/c2x-constexpr-dfp-1.c: Add tests of binary floating initializers for decimal types. * gcc.dg/dfp/c2x-constexpr-dfp-2.c: Change tests of binary initializers for decimal types. Add more tests of decimal initializers for binary types.
Showing
- gcc/c/c-typeck.cc 68 additions, 43 deletionsgcc/c/c-typeck.cc
- gcc/testsuite/gcc.dg/c2x-constexpr-1.c 4 additions, 0 deletionsgcc/testsuite/gcc.dg/c2x-constexpr-1.c
- gcc/testsuite/gcc.dg/c2x-constexpr-3.c 0 additions, 5 deletionsgcc/testsuite/gcc.dg/c2x-constexpr-3.c
- gcc/testsuite/gcc.dg/c2x-constexpr-8.c 2 additions, 0 deletionsgcc/testsuite/gcc.dg/c2x-constexpr-8.c
- gcc/testsuite/gcc.dg/c2x-constexpr-9.c 8 additions, 2 deletionsgcc/testsuite/gcc.dg/c2x-constexpr-9.c
- gcc/testsuite/gcc.dg/dfp/c2x-constexpr-dfp-1.c 10 additions, 0 deletionsgcc/testsuite/gcc.dg/dfp/c2x-constexpr-dfp-1.c
- gcc/testsuite/gcc.dg/dfp/c2x-constexpr-dfp-2.c 6 additions, 2 deletionsgcc/testsuite/gcc.dg/dfp/c2x-constexpr-dfp-2.c
Loading
Please register or sign in to comment