diff options
author | Marek Polacek <polacek@redhat.com> | 2024-06-28 17:51:19 -0400 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2024-07-01 14:32:41 -0400 |
commit | 52d71b6b1f0f465a6cf064f61b22fc99453ec132 (patch) | |
tree | 8eb0f6c97deea03b29b19b260e62e2398a3eb7af /gcc/ada | |
parent | 4d24159a1fcb15e1e28f46aa418de5e1ae384ff5 (diff) | |
download | gcc-52d71b6b1f0f465a6cf064f61b22fc99453ec132.zip gcc-52d71b6b1f0f465a6cf064f61b22fc99453ec132.tar.gz gcc-52d71b6b1f0f465a6cf064f61b22fc99453ec132.tar.bz2 |
c++: DR2627, Bit-fields and narrowing conversions [PR94058]
This DR (https://cplusplus.github.io/CWG/issues/2627.html) says that
even if we are converting from an integer type or unscoped enumeration type
to an integer type that cannot represent all the values of the original
type, it's not narrowing if "the source is a bit-field whose width w is
less than that of its type (or, for an enumeration type, its underlying
type) and the target type can represent all the values of a hypothetical
extended integer type with width w and with the same signedness as the
original type".
DR 2627
PR c++/94058
PR c++/104392
gcc/cp/ChangeLog:
* typeck2.cc (check_narrowing): Don't warn if the conversion isn't
narrowing as per DR 2627.
gcc/testsuite/ChangeLog:
* g++.dg/DRs/dr2627.C: New test.
* g++.dg/cpp0x/Wnarrowing22.C: New test.
* g++.dg/cpp2a/spaceship-narrowing1.C: New test.
* g++.dg/cpp2a/spaceship-narrowing2.C: New test.
Diffstat (limited to 'gcc/ada')
0 files changed, 0 insertions, 0 deletions