This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/71966] [7 Regression] ICE on invalid C++11 code (undefined constructor used in a constant expression): in cp_build_addr_expr_1, at cp/typeck.c:5671


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]