Commit a1e0490f by Jason Merrill Committed by Jason Merrill

re PR c++/51433 (constexpr caching leads to incorrect dynamic initialization)

	PR c++/51433
	* semantics.c (cxx_eval_call_expression): Always retry previously
	non-constant expressions.

From-SVN: r183065
parent 91f074ce
2012-01-10 Jason Merrill <jason@redhat.com>
PR c++/51433
* semantics.c (cxx_eval_call_expression): Always retry previously
non-constant expressions.
2012-01-06 Jason Merrill <jason@redhat.com>
DR 686
......
......@@ -6576,7 +6576,7 @@ cxx_eval_call_expression (const constexpr_call *old_call, tree t,
else
{
result = entry->result;
if (!result || (result == error_mark_node && !allow_non_constant))
if (!result || result == error_mark_node)
result = (cxx_eval_constant_expression
(&new_call, new_call.fundef->body,
allow_non_constant, addr,
......
2012-01-10 Jason Merrill <jason@redhat.com>
PR c++/51433
* g++.dg/cpp0x/constexpr-cache1.C: New.
2012-01-10 Richard Guenther <rguenther@suse.de>
PR tree-optimization/51801
......
// PR c++/51433
// { dg-options -std=c++0x }
constexpr int f();
constexpr int g() { return f(); }
extern const int n = g(); // dynamic initialization
constexpr int f() { return 42; }
extern const int m = g();
static_assert(m == 42, "m == 42");
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