diff options
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/pt.c | 8 |
2 files changed, 13 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7e8c465..2fa2e1e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2017-01-17 Jason Merrill <jason@redhat.com> + + PR c++/78894 - ICE with class deduction and default arg + * pt.c (build_deduction_guide): Set DECL_PRIMARY_TEMPLATE. + 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de> PR c++/77489 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 022ffda..6fd03a5 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -24968,6 +24968,13 @@ build_deduction_guide (tree ctor, tree outer_args, tsubst_flags_t complain) current_template_parms = save_parms; --processing_template_decl; } + else + { + /* Copy the parms so we can set DECL_PRIMARY_TEMPLATE. */ + tparms = copy_node (tparms); + INNERMOST_TEMPLATE_PARMS (tparms) + = copy_node (INNERMOST_TEMPLATE_PARMS (tparms)); + } tree fntype = build_function_type (type, fparms); tree ded_fn = build_lang_decl_loc (DECL_SOURCE_LOCATION (ctor), @@ -24978,6 +24985,7 @@ build_deduction_guide (tree ctor, tree outer_args, tsubst_flags_t complain) DECL_TEMPLATE_RESULT (ded_tmpl) = ded_fn; TREE_TYPE (ded_tmpl) = TREE_TYPE (ded_fn); DECL_TEMPLATE_INFO (ded_fn) = build_template_info (ded_tmpl, targs); + DECL_PRIMARY_TEMPLATE (ded_tmpl) = ded_tmpl; if (ci) set_constraints (ded_tmpl, ci); |