[Bug c++/92171] accept incorrect access of static constexpr member when read from a reference

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 29 18:50:00 GMT 2020


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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The constexpr evaluator doesn't see the "ref." part at all: VALUE is a static
data member, so build_class_member_access_expr produces "value":

(gdb) pt result
 <var_decl 0x7ffff7ffbbd0 value
    type <boolean_type 0x7fffeaa22b28 bool readonly unsigned type_6 QI
        size <integer_cst 0x7fffea8ddf60 constant 8>
        unit-size <integer_cst 0x7fffea8ddf78 constant 1>
        align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7fffeaa22b28 precision:1 min <integer_cst 0x7fffea8fe1c8 0> max <integer_cst
0x7fffea8fe1f8 1>>
    readonly constant used public static tree_1 tree_2 tree_6 unsigned nonlocal
weak decl_5 decl_6 QI 92171.C:5:25 size <integer_cst 0x7fffea8ddf60 8>
unit-size <integer_cst 0x7fffea8ddf78 1>
    align:8 warn_if_not_align:0 context <record_type 0x7fffeaa229d8 A> initial
<integer_cst 0x7fffea8fe1c8 0>
    chain <type_decl 0x7fffea90ba18 A>>


More information about the Gcc-bugs mailing list