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

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The fix for 77656 caused us to call convert_nontype_argument even for
value-dependent arguments, to perform the conversion in order to avoid a bogus
warning.

In this case, the argument is Pod{N}.  The call to
build_converted_constant_expr in convert_nontype_argument produces
Pod::operator Enum(&{N}).  It doesn't crash because we're in a template and
build_address no longer crashed on CONSTRUCTORs in a template.

Then when instantiating  function foo we substitute its argument: &{N}.  So
we're in tsubst_copy_and_build/ADDR_EXPR.  The call to
tsubst_non_call_postfix_expression turns {N} into TARGET_EXPR <D.2329,
{.val=2}>.
Then build_x_unary_op is supposed to put the ADDR_EXPR back.  It calls
cp_build_addr_expr_strict.  But it's *strict*, so the prvalue of class type
TARGET_EXPR <D.2329, {.val=2}> isn't allowed -> error.

Reply via email to