tree pbinfo;
tree base_list;
unsigned int saved_maximum_field_alignment;
- tree fn_context;
if (type == error_mark_node)
return error_mark_node;
it now. */
push_deferring_access_checks (dk_no_deferred);
- fn_context = decl_function_context (TYPE_MAIN_DECL (type));
- if (!fn_context)
- push_to_top_level ();
+ push_to_top_level ();
/* Use #pragma pack from the template context. */
saved_maximum_field_alignment = maximum_field_alignment;
maximum_field_alignment = TYPE_PRECISION (pattern);
apply_lambda_return_type (lambda, void_type_node);
LAMBDA_EXPR_RETURN_TYPE (lambda) = NULL_TREE;
}
-
- LAMBDA_EXPR_THIS_CAPTURE (lambda)
- = lookup_field_1 (type, get_identifier ("__this"), false);
-
instantiate_decl (decl, false, false);
maybe_add_lambda_conv_op (type);
-
- LAMBDA_EXPR_THIS_CAPTURE (lambda) = NULL_TREE;
}
else
gcc_assert (errorcount);
perform_deferred_access_checks ();
pop_nested_class ();
maximum_field_alignment = saved_maximum_field_alignment;
- if (!fn_context)
- pop_from_top_level ();
+ pop_from_top_level ();
pop_deferring_access_checks ();
pop_tinst_level ();
tree spec;
tree gen_tmpl;
bool pattern_defined;
+ int need_push;
location_t saved_loc = input_location;
bool external_p;
- tree fn_context;
- bool nested;
/* This function should only be used to instantiate templates for
functions and static member variables. */
goto out;
}
- fn_context = decl_function_context (d);
- nested = (current_function_decl != NULL_TREE);
- if (!fn_context)
+ need_push = !cfun || !global_bindings_p ();
+ if (need_push)
push_to_top_level ();
- else if (nested)
- push_function_context ();
/* Mark D as instantiated so that recursive calls to
instantiate_decl do not try to instantiate it again. */
/* We're not deferring instantiation any more. */
TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (d)) = 0;
- if (!fn_context)
+ if (need_push)
pop_from_top_level ();
- else if (nested)
- pop_function_context ();
out:
input_location = saved_loc;