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
This commit is contained in:
parent
91f074ced1
commit
a1e0490fb8
@ -1,3 +1,9 @@
|
||||
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,
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
9
gcc/testsuite/g++.dg/cpp0x/constexpr-cache1.C
Normal file
9
gcc/testsuite/g++.dg/cpp0x/constexpr-cache1.C
Normal file
@ -0,0 +1,9 @@
|
||||
// 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");
|
Loading…
Reference in New Issue
Block a user