Commit 81ede53a by Jason Merrill Committed by Jason Merrill

re PR c++/55137 (Unexpected static structure initialization)

	PR c++/55137
	* semantics.c (verify_constant): Track overflow separately.
	(reduced_constant_expression_p): Don't check it here.
	(cxx_eval_constant_expression): Check it on CSTs.
	(cxx_eval_outermost_constant_expr): Treat overflows as non-constant
	at this point, but still return the folded version.
	(potential_constant_expression_1): Don't check overflow.

From-SVN: r193727
parent 0c0cba54
2012-11-22 Jason Merrill <jason@redhat.com>
PR c++/55137
* semantics.c (verify_constant): Track overflow separately.
(reduced_constant_expression_p): Don't check it here.
(cxx_eval_constant_expression): Check it on CSTs.
(cxx_eval_outermost_constant_expr): Treat overflows as non-constant
at this point, but still return the folded version.
(potential_constant_expression_1): Don't check overflow.
* call.c (extend_ref_init_temps_1): Recompute TREE_CONSTANT for
the ADDR_EXPR.
......
// PR c++/55137
// s should have constant initialization.
// { dg-final { scan-assembler-not "GLOBAL" } }
struct S {
int b;
};
struct S s = { -1 + (int)(sizeof(int) - 1) };
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