aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2017-08-29 15:40:32 -0400
committerJason Merrill <jason@gcc.gnu.org>2017-08-29 15:40:32 -0400
commit4cc20315a7e67b6ebbdbfbb736122476bf28f041 (patch)
tree323df1dad5e1d69c5816385c22bea03298130eac /gcc/cp
parent82b0ce2eb32bea3d6e35609d1806ba332576826d (diff)
downloadgcc-4cc20315a7e67b6ebbdbfbb736122476bf28f041.zip
gcc-4cc20315a7e67b6ebbdbfbb736122476bf28f041.tar.gz
gcc-4cc20315a7e67b6ebbdbfbb736122476bf28f041.tar.bz2
Adjust C++17 class deduction use of DECL_ABSTRACT_ORIGIN.
* pt.c (build_deduction_guide): Set DECL_ABSTRACT_ORIGIN on the template, not the function. (template_guide_p): Adjust. From-SVN: r251425
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/pt.c13
2 files changed, 10 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b4e21f6..ea410c1 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
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.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 1b726ff..416d17b 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -25079,11 +25079,9 @@ template_guide_p (const_tree fn)
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;
}
@@ -25194,6 +25192,7 @@ build_deduction_guide (tree ctor, tree outer_args, tsubst_flags_t complain)
bool memtmpl = false;
bool explicit_p;
location_t loc;
+ tree fn_tmpl = NULL_TREE;
if (TYPE_P (ctor))
{
@@ -25219,7 +25218,7 @@ build_deduction_guide (tree ctor, tree outer_args, tsubst_flags_t complain)
{
++processing_template_decl;
- tree fn_tmpl
+ fn_tmpl
= (TREE_CODE (ctor) == TEMPLATE_DECL ? ctor
: DECL_TI_TEMPLATE (ctor));
if (outer_args)
@@ -25334,7 +25333,7 @@ build_deduction_guide (tree ctor, tree outer_args, tsubst_flags_t complain)
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);