https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33819

--- Comment #13 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Mon Sep 16 04:34:28 2019
New Revision: 275746

URL: https://gcc.gnu.org/viewcvs?rev=275746&root=gcc&view=rev
Log:
        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.

Added:
    trunk/gcc/testsuite/g++.dg/expr/bitfield14.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck.c

Reply via email to