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++/84978] [8 Regression] ICE in cxx_eval_constant_expression at gcc/cp/constexpr.c:4109


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))

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