[Bug c++/84978] [8 Regression] ICE in cxx_eval_constant_expression at gcc/cp/constexpr.c:4109
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Mar 20 12:02:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84978
--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
So we can be more careful there and do:
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -4111,7 +4111,15 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx,
tree t,
/* We ask for an rvalue for the RESULT_DECL when indirecting
through an invisible reference, or in named return value
optimization. */
- return (*ctx->values->get (t));
+ if (tree *p = ctx->values->get (t))
+ return *p;
+ else
+ {
+ if (!ctx->quiet)
+ error ("%qE is not a constant expression", t);
+ *non_constant_p = true;
+ }
+ break;
case VAR_DECL:
if (DECL_HAS_VALUE_EXPR_P (t))
More information about the Gcc-bugs
mailing list