diff mbox

Two small constexpr PATCHes

Message ID 547619A9.4090808@redhat.com
State New
Headers show

Commit Message

Jason Merrill Nov. 26, 2014, 6:19 p.m. UTC
1) It occurred to me that now that there are side-effects in 
constant-expressions, we need to guard against multiple evaluation of 
SAVE_EXPR.

2) We don't want to complain about flowing off the end of a function 
because something in the function was non-constant.

Tested x86_64-pc-linux-gnu, applying to trunk.
diff mbox

Patch

commit e1851b1d2be83cf9ee13a8a21faac3dcac52d746
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Nov 26 12:00:20 2014 -0500

    	* constexpr.c (cxx_eval_call_expression): Don't talk about
    	flowing off the end if we're already non-constant.

diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 2678223..111ea5b 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -1344,7 +1344,7 @@  cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
 	      else
 		{
 		  result = *ctx->values->get (slot ? slot : res);
-		  if (result == NULL_TREE)
+		  if (result == NULL_TREE && !*non_constant_p)
 		    {
 		      if (!ctx->quiet)
 			error ("constexpr call flows off the end "