This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[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
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 02 Jan 2017 14:26:36 +0000
- Subject: [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
- Auto-submitted: auto-generated
- References: <bug-71966-4@http.gcc.gnu.org/bugzilla/>
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.