diff options
author | Joseph Myers <joseph@codesourcery.com> | 2023-02-02 20:07:08 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2023-02-02 20:07:08 +0000 |
commit | 66337ff8a44559fa4600014786051a2bdd1f986b (patch) | |
tree | 62e2cf7940c5b27d54abdf792979a2bdd2b5d1d3 /libstdc++-v3 | |
parent | 5c43f06c228d169c370e99fa009154344fa305b8 (diff) | |
download | gcc-66337ff8a44559fa4600014786051a2bdd1f986b.zip gcc-66337ff8a44559fa4600014786051a2bdd1f986b.tar.gz gcc-66337ff8a44559fa4600014786051a2bdd1f986b.tar.bz2 |
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.
Diffstat (limited to 'libstdc++-v3')
0 files changed, 0 insertions, 0 deletions