PR c++/30277 - int-width bit-field promotion.
authorJason Merrill <jason@redhat.com>
Mon, 16 Sep 2019 04:34:28 +0000 (00:34 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 16 Sep 2019 04:34:28 +0000 (00:34 -0400)
commitddc1a45b373ce98929d0d67e8c97ab6783236c40
treeb9bb7f45f7ac6bf4b3c98acb45531feae12abf9e
parent47518e131f299f69d0c14f7e5efe83609185ed9f
PR c++/30277 - int-width bit-field promotion.

Here, if cp_perform_integral_promotions saw that the TREE_TYPE of a
bit-field reference was the same as the type it promotes to, it didn't do
anything.  But then decay_conversion saw that the bit-field reference was
unchanged, and converted it to its declared type.  So I needed to add
something to make it clear that promotion has been done.  But then the 33819
change caused trouble by looking through the NOP_EXPR I just added.  This
was the wrong fix for that bug; I've now fixed that better by recognizing in
cp_perform_integral_promotions that we won't promote a bit-field larger than
32 bits, so we should use the declared type.

PR c++/33819 - long bit-field promotion.
* typeck.c (cp_perform_integral_promotions): Handle large bit-fields
properly.  Handle 32-bit non-int bit-fields properly.
(is_bitfield_expr_with_lowered_type): Don't look through NOP_EXPR.

From-SVN: r275746
gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/g++.dg/expr/bitfield14.C [new file with mode: 0644]