diff options
author | Jakub Jelinek <jakub@redhat.com> | 2021-12-04 11:02:15 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2021-12-04 11:02:15 +0100 |
commit | c57c910c945ac68ba9a7cda9b0f963173781d58c (patch) | |
tree | 32117623ca59d79f56b51c0f039a0081802a184d /gcc/diagnostic-spec.c | |
parent | 55dfce4d5cb4a366ced7e1194a1c7f04389e3087 (diff) | |
download | gcc-c57c910c945ac68ba9a7cda9b0f963173781d58c.zip gcc-c57c910c945ac68ba9a7cda9b0f963173781d58c.tar.gz gcc-c57c910c945ac68ba9a7cda9b0f963173781d58c.tar.bz2 |
c++: Allow indeterminate unsigned char or std::byte in bit_cast - P1272R4
P1272R4 has added to the std::byteswap new stuff to me quite unrelated
clarification for std::bit_cast.
The patch treats it as DR, applying to all languages.
We no longer diagnose if padding bits are stored into unsigned char
or std::byte result, fields or bitfields, instead arrange for that result,
those fields or bitfields to get indeterminate value (empty
CONSTRUCTOR with CONSTRUCTOR_NO_ZEROING or just leaving the member's
initializer out and setting CONSTRUCTOR_NO_ZEROING on parent).
We still have a bug that we don't diagnose in lots of places lvalue-to-rvalue
conversions of indeterminate values or class objects with some indeterminate
members.
2021-12-04 Jakub Jelinek <jakub@redhat.com>
* cp-tree.h (is_byte_access_type_not_plain_char): Declare.
* tree.c (is_byte_access_type_not_plain_char): New function.
* constexpr.c (clear_uchar_or_std_byte_in_mask): New function.
(cxx_eval_bit_cast): Don't error about padding bits if target
type is unsigned char or std::byte, instead return no clearing
ctor. Use clear_uchar_or_std_byte_in_mask.
* g++.dg/cpp2a/bit-cast11.C: New test.
* g++.dg/cpp2a/bit-cast12.C: New test.
* g++.dg/cpp2a/bit-cast13.C: New test.
* g++.dg/cpp2a/bit-cast14.C: New test.
Diffstat (limited to 'gcc/diagnostic-spec.c')
0 files changed, 0 insertions, 0 deletions