2017-08-29 Jason Merrill <jason@redhat.com>
+ * pt.c (build_deduction_guide): Set DECL_ABSTRACT_ORIGIN on the
+ template, not the function.
+ (template_guide_p): Adjust.
+
Support copying local_specializations.
* cp-tree.h (enum lss_policy): New.
(local_specialization_stack): Add policy parameter to default ctor.
gcc_assert (deduction_guide_p (fn));
if (!DECL_ARTIFICIAL (fn))
return false;
- if (tree ctor = DECL_ABSTRACT_ORIGIN (fn))
- {
- tree tmpl = DECL_TI_TEMPLATE (ctor);
- return PRIMARY_TEMPLATE_P (tmpl);
- }
+ tree tmpl = DECL_TI_TEMPLATE (fn);
+ if (tree org = DECL_ABSTRACT_ORIGIN (tmpl))
+ return PRIMARY_TEMPLATE_P (org);
return false;
}
bool memtmpl = false;
bool explicit_p;
location_t loc;
+ tree fn_tmpl = NULL_TREE;
if (TYPE_P (ctor))
{
{
++processing_template_decl;
- tree fn_tmpl
+ fn_tmpl
= (TREE_CODE (ctor) == TEMPLATE_DECL ? ctor
: DECL_TI_TEMPLATE (ctor));
if (outer_args)
DECL_TEMPLATE_INFO (ded_fn) = build_template_info (ded_tmpl, targs);
DECL_PRIMARY_TEMPLATE (ded_tmpl) = ded_tmpl;
if (DECL_P (ctor))
- DECL_ABSTRACT_ORIGIN (ded_fn) = ctor;
+ DECL_ABSTRACT_ORIGIN (ded_tmpl) = fn_tmpl;
if (ci)
set_constraints (ded_tmpl, ci);