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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Perhaps we should drop the
      if (TREE_ADDRESSABLE (type))
        /* Undo convert_for_arg_passing work here.  */
        x = convert_from_reference (x);
in cxx_bind_parameters_in_call and somewhere at the start of
cxx_eval_constant_expression's PARM_DECL: case
    case PARM_DECL:
      if (lval && !TYPE_REF_P (TREE_TYPE (t)))
        /* glvalue use.  */;
      else if (tree v = ctx->global->get_value (t))
        r = v;
      else if (lval)
        /* Defer in case this is only used for its type.  */;
      else if (ctx->global->is_outside_lifetime (t))
handle the TREE_ADDRESSABLE (TREE_TYPE (t)) cases differently
(ctx->global->get_value if successful followed essentially by artificial
conversion from reference?  Though not really sure if &x will then cancel out
to & of the TARGET_EXPR etc.
On this testcase after removing that cxx_bind_parameters_in_call hunk
cxx_eval_constant_expression in there results in &D.2836.
x in there is &TARGET_EXPR <D.2836, ...>.

Reply via email to