+2013-09-12 Adam Butcher <adam@jessamine.co.uk>
+
+ * pt.c (instantiate_decl): Save/restore cp_unevaluated_operand and
+ c_inhibit_evaluation_warnings. Reset if instantiating within a
+ function-local template.
+
2013-09-12 Paolo Carlini <paolo.carlini@oracle.com>
* semantics.c (finish_pseudo_destructor_expr): Add location_t
tree gen_tmpl;
bool pattern_defined;
location_t saved_loc = input_location;
+ int saved_unevaluated_operand = cp_unevaluated_operand;
+ int saved_inhibit_evaluation_warnings = c_inhibit_evaluation_warnings;
bool external_p;
tree fn_context;
bool nested;
nested = (current_function_decl != NULL_TREE);
if (!fn_context)
push_to_top_level ();
- else if (nested)
- push_function_context ();
+ else
+ {
+ if (nested)
+ push_function_context ();
+ cp_unevaluated_operand = 0;
+ c_inhibit_evaluation_warnings = 0;
+ }
/* Mark D as instantiated so that recursive calls to
instantiate_decl do not try to instantiate it again. */
out:
input_location = saved_loc;
+ cp_unevaluated_operand = saved_unevaluated_operand;
+ c_inhibit_evaluation_warnings = saved_inhibit_evaluation_warnings;
pop_deferring_access_checks ();
pop_tinst_level ();