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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |ppalka at gcc dot gnu.org

--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
For the original testcase, evaluation of pf->get_this(); yields &heap [0]
instead of  the expected &heap, which we don't recognize as a valid constexpr
heap pointer thus leading to the error.

This heap[0] term gets built from cxx_fold_indirect_ref which folds '*(struct
Derived *) &heap' into 'heap[0]' (where 'heap' has type Derived[1]), which
doesn't seem like a sound transformation?  I'd expect it to get folded to
simply 'heap'.

Then again this intermediate (Derived *) cast seems unsound in the first place
since we're casting something of type Derived[1]* to Derived*.  I don't know
what to make of that.

Reply via email to