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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Apparently this is because
  else if (non_constant_p && TREE_CONSTANT (r))
    {
      /* This isn't actually constant, so unset TREE_CONSTANT.  */
      if (EXPR_P (r))
        r = copy_node (r);
      else if (TREE_CODE (r) == CONSTRUCTOR)
        r = build1 (VIEW_CONVERT_EXPR, TREE_TYPE (r), r);
      else
        r = build_nop (TREE_TYPE (r), r);
      TREE_CONSTANT (r) = false;
    }
creates a NOP_EXPR around the VAR_DECL so that it can have !TREE_CONSTANT.
Then we try to implicitly convert that NOP_EXPR to int, find the user
conversion and build_user_type_conversion_1 -> add_candidates attempts to emit
a method call with &NOP_EXPR<a>, which is not allowed.  I think we need to
strip such NOP_EXPR away somewhere, but not sure where.

Reply via email to