https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105529
Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org --- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> --- Therefore, a potential fix would be: --- a/gcc/cp/constexpr.cc +++ b/gcc/cp/constexpr.cc @@ -5916,8 +5916,9 @@ cxx_eval_store_expression (const constexpr_ctx *ctx, tree t, gcc_checking_assert (!*valp || (same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (*valp), type))); - if (empty_base || !(same_type_ignoring_top_level_qualifiers_p - (TREE_TYPE (init), type))) + if (empty_base || (CLASS_TYPE_P (TREE_TYPE (init)) + && !(same_type_ignoring_top_level_qualifiers_p + (TREE_TYPE (init), type)))) { /* For initialization of an empty base, the original target will be *(base*)this, evaluation of which resolves to the object This code expects code like D.2181 = {} where the type of the LHS is the derived type and the type of the RHS is the base type.