aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 92c8e51b746..db27ad28f3b 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -11732,8 +11732,6 @@ fold_expression (tree t, tree left, tree right, tsubst_flags_t complain)
{
case COMPOUND_EXPR:
return build_x_compound_expr (input_location, left, right, complain);
- case DOTSTAR_EXPR:
- return build_m_component_ref (left, right, complain);
default:
return build_x_binary_op (input_location, code,
left, TREE_CODE (left),
@@ -13023,6 +13021,11 @@ tsubst_function_decl (tree t, tree args, tsubst_flags_t complain,
set_constraints (r, ci);
}
+ if (DECL_FRIEND_P (t) && DECL_FRIEND_CONTEXT (t))
+ SET_DECL_FRIEND_CONTEXT (r,
+ tsubst (DECL_FRIEND_CONTEXT (t),
+ args, complain, in_decl));
+
/* Set up the DECL_TEMPLATE_INFO for R. There's no need to do
this in the special friend case mentioned above where
GEN_TMPL is NULL. */
@@ -13084,11 +13087,6 @@ tsubst_function_decl (tree t, tree args, tsubst_flags_t complain,
&& !grok_op_properties (r, /*complain=*/true))
return error_mark_node;
- if (DECL_FRIEND_P (t) && DECL_FRIEND_CONTEXT (t))
- SET_DECL_FRIEND_CONTEXT (r,
- tsubst (DECL_FRIEND_CONTEXT (t),
- args, complain, in_decl));
-
/* Possibly limit visibility based on template args. */
DECL_VISIBILITY (r) = VISIBILITY_DEFAULT;
if (DECL_VISIBILITY_SPECIFIED (t))
@@ -18896,17 +18894,10 @@ tsubst_copy_and_build (tree t,
{
tree r = tsubst_copy (t, args, complain, in_decl);
/* ??? We're doing a subset of finish_id_expression here. */
- if (VAR_P (r)
- && !processing_template_decl
- && !cp_unevaluated_operand
- && (TREE_STATIC (r) || DECL_EXTERNAL (r))
- && CP_DECL_THREAD_LOCAL_P (r))
- {
- if (tree wrap = get_tls_wrapper_fn (r))
- /* Replace an evaluated use of the thread_local variable with
- a call to its wrapper. */
- r = build_cxx_call (wrap, 0, NULL, tf_warning_or_error);
- }
+ if (tree wrap = maybe_get_tls_wrapper_call (r))
+ /* Replace an evaluated use of the thread_local variable with
+ a call to its wrapper. */
+ r = wrap;
else if (outer_automatic_var_p (r))
r = process_outer_var_ref (r, complain);
@@ -26004,8 +25995,10 @@ make_auto (void)
tree
make_template_placeholder (tree tmpl)
{
- tree t = make_auto_1 (DECL_NAME (tmpl), true);
+ tree t = make_auto_1 (DECL_NAME (tmpl), false);
CLASS_PLACEHOLDER_TEMPLATE (t) = tmpl;
+ /* Our canonical type depends on the placeholder. */
+ TYPE_CANONICAL (t) = canonical_type_parameter (t);
return t;
}
@@ -26540,6 +26533,9 @@ do_class_deduction (tree ptype, tree tmpl, tree init, int flags,
error ("non-class template %qT used without template arguments", tmpl);
return error_mark_node;
}
+ if (init && TREE_TYPE (init) == ptype)
+ /* Using the template parm as its own argument. */
+ return ptype;
tree type = TREE_TYPE (tmpl);
@@ -26607,7 +26603,7 @@ do_class_deduction (tree ptype, tree tmpl, tree init, int flags,
tree outer_args = NULL_TREE;
if (DECL_CLASS_SCOPE_P (tmpl)
- && CLASSTYPE_TEMPLATE_INFO (DECL_CONTEXT (tmpl)))
+ && CLASSTYPE_TEMPLATE_INSTANTIATION (DECL_CONTEXT (tmpl)))
{
outer_args = CLASSTYPE_TI_ARGS (DECL_CONTEXT (tmpl));
type = TREE_TYPE (most_general_template (tmpl));