diff mbox

C++ PATCH to make constexpr respect -fno-inline

Message ID 56CDC97D.2090608@redhat.com
State New
Headers show

Commit Message

Jason Merrill Feb. 24, 2016, 3:17 p.m. UTC
While talking about constexpr issues it occurred to me that we ought not 
fold away calls to constexpr functions in regular expressions when the 
user has specified -fno-inline, so that they can debug those calls normally.

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

Patch

commit bf89c79569525294101eb024502fcc03011b16d2
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Feb 22 13:32:50 2016 -0500

    	* cp-gimplify.c (cp_fold): Don't fold constexpr calls if -fno-inline.

diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index 34bdc82..c59cd90 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -2154,7 +2154,8 @@  cp_fold (tree x)
 	   TODO:
 	   Do constexpr expansion of expressions where the call itself is not
 	   constant, but the call followed by an INDIRECT_REF is.  */
-	if (callee && DECL_DECLARED_CONSTEXPR_P (callee))
+	if (callee && DECL_DECLARED_CONSTEXPR_P (callee)
+	    && !flag_no_inline)
           r = maybe_constant_value (x);
 	optimize = sv;