@@ -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)
@@ -10,8 +10,8 @@ const A a = 42;
constexpr int f()
{
- const int j = a.i; // { dg-message "'a'" }
+ const int j = a.i; // { dg-error "'a'" }
return j;
}
-static_assert (f() == 42,""); // { dg-error "non-constant" }
+static_assert (f() == 42,""); // { dg-error "" }
@@ -27,4 +27,4 @@ bar ()
return fn1 () + fn2 () + (s.*fn3) () + (s.*fn4) () + fn5 () + (s.*fn6) () + (s.*fn7) ();
}
-auto a = bar ();
+auto a = bar (); // { dg-error "bar" }
@@ -10,4 +10,4 @@ consteval int qux () { S s = baz (); return s.b + s.c (); }
consteval int quux () { constexpr S s = baz (); return s.b + s.c (); } // { dg-error "immediate evaluation returns address of immediate function 'consteval int foo\\(\\)'" }
constexpr auto d = baz (); // { dg-error "immediate evaluation returns address of immediate function 'consteval int foo\\(\\)'" }
constexpr auto e = qux ();
-constexpr auto f = quux ();
+constexpr auto f = quux (); // { dg-error "quux" }
@@ -9,4 +9,4 @@ foo ()
return i;
}
-constexpr int i = foo ();
+constexpr int i = foo (); // { dg-error "foo" }