diff options
author | Marek Polacek <polacek@redhat.com> | 2021-12-04 12:07:41 -0500 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2021-12-07 08:26:25 -0500 |
commit | 3a2257e6b3fa288d6c50831987949b9ff7dfb865 (patch) | |
tree | 90a5927585968e6fbe3f12a1432dbb6a8c7959f5 /gcc/fortran/array.c | |
parent | 7ef68c37b3a46e69ed4a5ff6b2b368e2c9a8023f (diff) | |
download | gcc-3a2257e6b3fa288d6c50831987949b9ff7dfb865.zip gcc-3a2257e6b3fa288d6c50831987949b9ff7dfb865.tar.gz gcc-3a2257e6b3fa288d6c50831987949b9ff7dfb865.tar.bz2 |
c++: Fix for decltype and bit-fields [PR95009]
Here, decltype deduces the wrong type for certain expressions involving
bit-fields. Unlike in C, in C++ bit-field width is explicitly not part
of the type, so I think decltype should never deduce to 'int:N'. The
problem isn't that we're not calling unlowered_expr_type--we are--it's
that is_bitfield_expr_with_lowered_type only handles certain codes, but
not others. For example, += works fine but ++ does not.
This also fixes decltype-bitfield2.C where we were crashing (!), but
unfortunately it does not fix 84516 or 70733 where the problem is likely
a missing call to unlowered_expr_type. It occurs to me now that typeof
likely has had the same issue, but this patch should fix that too.
PR c++/95009
gcc/cp/ChangeLog:
* typeck.c (is_bitfield_expr_with_lowered_type) <case MODIFY_EXPR>:
Handle UNARY_PLUS_EXPR, NEGATE_EXPR, NON_LVALUE_EXPR, BIT_NOT_EXPR,
P*CREMENT_EXPR too.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/decltype-bitfield1.C: New test.
* g++.dg/cpp0x/decltype-bitfield2.C: New test.
Diffstat (limited to 'gcc/fortran/array.c')
0 files changed, 0 insertions, 0 deletions