]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/cp/constexpr.cc
c++: check DECL_INITIAL for constexpr
[thirdparty/gcc.git] / gcc / cp / constexpr.cc
index 10639876d9cfc45694f8cecd84213e9a5c8abd5c..ed41d7552696ab137db13098de4c46b7f56b5d40 100644 (file)
@@ -8892,7 +8892,10 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
       {
         tree from = TREE_OPERAND (t, 0);
        if (location_wrapper_p (t))
-         return (RECUR (from, want_rval));
+         {
+           iloc_sentinel ils = loc;
+           return (RECUR (from, want_rval));
+         }
        if (INDIRECT_TYPE_P (TREE_TYPE (t)))
          {
            STRIP_ANY_LOCATION_WRAPPER (from);
@@ -9348,7 +9351,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
                   (tmp, /*constexpr_context_p=*/true, flags))
            return false;
        }
-      return RECUR (tmp, want_rval);
+      return RECUR (DECL_INITIAL (tmp), want_rval);
 
     case TRY_FINALLY_EXPR:
       return (RECUR (TREE_OPERAND (t, 0), want_rval)