Commit acfdb960 by Jakub Jelinek Committed by Jakub Jelinek

constexpr.c (cxx_eval_constant_expression): Temporarily change input_location to…

constexpr.c (cxx_eval_constant_expression): Temporarily change input_location to CLEANUP_STMT location.

	* constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>:
	Temporarily change input_location to CLEANUP_STMT location.

	* g++.dg/cpp2a/constexpr-dtor3.C: Expect in 'constexpr' expansion of
	message on the line with variable declaration.
	* g++.dg/ext/constexpr-attr-cleanup1.C: Likewise.

From-SVN: r277320
parent 149a3e4d
2019-10-23 Jakub Jelinek <jakub@redhat.com>
* constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>:
Temporarily change input_location to CLEANUP_STMT location.
2019-10-22 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/85887
......
......@@ -4988,14 +4988,20 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
non_constant_p, overflow_p,
jump_target);
if (!CLEANUP_EH_ONLY (t) && !*non_constant_p)
/* Also evaluate the cleanup. If we weren't skipping at the
start of the CLEANUP_BODY, change jump_target temporarily
to &initial_jump_target, so that even a return or break or
continue in the body doesn't skip the cleanup. */
cxx_eval_constant_expression (ctx, CLEANUP_EXPR (t), true,
non_constant_p, overflow_p,
jump_target ? &initial_jump_target
: NULL);
{
location_t loc = input_location;
if (EXPR_HAS_LOCATION (t))
input_location = EXPR_LOCATION (t);
/* Also evaluate the cleanup. If we weren't skipping at the
start of the CLEANUP_BODY, change jump_target temporarily
to &initial_jump_target, so that even a return or break or
continue in the body doesn't skip the cleanup. */
cxx_eval_constant_expression (ctx, CLEANUP_EXPR (t), true,
non_constant_p, overflow_p,
jump_target ? &initial_jump_target
: NULL);
input_location = loc;
}
}
break;
......
2019-10-23 Jakub Jelinek <jakub@redhat.com>
* g++.dg/cpp2a/constexpr-dtor3.C: Expect in 'constexpr' expansion of
message on the line with variable declaration.
* g++.dg/ext/constexpr-attr-cleanup1.C: Likewise.
2019-10-23 Eric Botcazou <ebotcazou@adacore.com>
* gcc.c-torture/execute/20191023-1.c: New test.
......
......@@ -149,7 +149,7 @@ constexpr int x3 = f3 ();
constexpr int
f4 ()
{
W7 w13 = 5;
W7 w13 = 5; // { dg-message "in 'constexpr' expansion of" }
return 0;
}
......
......@@ -15,7 +15,7 @@ cleanup2 (int *x)
constexpr bool
foo ()
{
int a __attribute__((cleanup (cleanup))) = 1;
int a __attribute__((cleanup (cleanup))) = 1; // { dg-message "in 'constexpr' expansion of" }
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment