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

Alexandre Oliva <aoliva at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aoliva at gcc dot gnu.org

--- Comment #6 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Created attachment 45051
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45051&action=edit
patch for context, viable work-around but probably not suitable for inclusion

The one remaining problem is that a constexpr TARGET_EXPR initializer with an
empty CONSTRUCTOR is recreated in cxx_eval_outermost_constant_expr, because
adjust_temp_type only returns the original expr when types compare the same
pointer-wise (they differ in qualifiers in this case), and then
maybe_constant_value fails the assert because the original and evaled exprs
compare equal, because CONSTRUCTOR types are compared with same_type_p.

I don't like this change, though; if it's ok to disregard the qualifiers in the
type of the TARGET_EXPR initializer, then we might as well use same_type_p in
adjust_temp_type and avoid creating the CONSTRUCTOR with the different type,
though that regresses g++.robertl/eb73.C, probably because of some NULL type.  

OTOH, we could accept TARGET_EXPRs that compare equal but that are actually
different, but I guess they could be anywhere in the expression.

Thoughts?

Reply via email to