Commit 82b0ce2e by Jason Merrill Committed by Jason Merrill

Support copying local_specializations.

	* cp-tree.h (enum lss_policy): New.
	(local_specialization_stack): Add policy parameter to default ctor.
	* pt.c (local_specialization_stack): Copy local_specializations if
	lss_copy.

From-SVN: r251424
parent a0ab7ccd
2017-08-29 Jason Merrill <jason@redhat.com> 2017-08-29 Jason Merrill <jason@redhat.com>
Support copying local_specializations.
* cp-tree.h (enum lss_policy): New.
(local_specialization_stack): Add policy parameter to default ctor.
* pt.c (local_specialization_stack): Copy local_specializations if
lss_copy.
* constexpr.c (potential_constant_expression_1): Add "now" parm. * constexpr.c (potential_constant_expression_1): Add "now" parm.
(is_constant_expression, require_constant_expression): New. (is_constant_expression, require_constant_expression): New.
(is_static_init_expression, is_nondependent_constant_expression) (is_static_init_expression, is_nondependent_constant_expression)
......
...@@ -5117,9 +5117,10 @@ enum unification_kind_t { ...@@ -5117,9 +5117,10 @@ enum unification_kind_t {
// An RAII class used to create a new pointer map for local // An RAII class used to create a new pointer map for local
// specializations. When the stack goes out of scope, the // specializations. When the stack goes out of scope, the
// previous pointer map is restored. // previous pointer map is restored.
enum lss_policy { lss_blank, lss_copy };
struct local_specialization_stack struct local_specialization_stack
{ {
local_specialization_stack (); local_specialization_stack (lss_policy = lss_blank);
~local_specialization_stack (); ~local_specialization_stack ();
hash_map<tree, tree> *saved; hash_map<tree, tree> *saved;
......
...@@ -77,10 +77,13 @@ static tree cur_stmt_expr; ...@@ -77,10 +77,13 @@ static tree cur_stmt_expr;
// //
// Implementation of the RAII helper for creating new local // Implementation of the RAII helper for creating new local
// specializations. // specializations.
local_specialization_stack::local_specialization_stack () local_specialization_stack::local_specialization_stack (lss_policy policy)
: saved (local_specializations) : saved (local_specializations)
{ {
if (policy == lss_blank || !saved)
local_specializations = new hash_map<tree, tree>; local_specializations = new hash_map<tree, tree>;
else
local_specializations = new hash_map<tree, tree>(*saved);
} }
local_specialization_stack::~local_specialization_stack () local_specialization_stack::~local_specialization_stack ()
......
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