diff options
author | Jason Merrill <jason@redhat.com> | 2017-06-29 17:13:43 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2017-06-29 17:13:43 -0400 |
commit | 47304c6a0b365ca21d95be5e532e8d5925ed04f3 (patch) | |
tree | c1ead2d566ada6c866769d22ae8d566990fcc739 /gcc/cp | |
parent | f990f3a3b68334b54faea6de0f4edfbd8f23b8f0 (diff) | |
download | gcc-47304c6a0b365ca21d95be5e532e8d5925ed04f3.zip gcc-47304c6a0b365ca21d95be5e532e8d5925ed04f3.tar.gz gcc-47304c6a0b365ca21d95be5e532e8d5925ed04f3.tar.bz2 |
PR c++/81180 - ICE with C++17 deduction of member class template.
* pt.c (build_deduction_guide): Correct member template handling.
From-SVN: r249816
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/pt.c | 20 |
2 files changed, 12 insertions, 11 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0fae3cd..5549f72 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2017-06-29 Jason Merrill <jason@redhat.com> + PR c++/81180 - ICE with C++17 deduction of member class template. + * pt.c (build_deduction_guide): Correct member template handling. + PR c++/81188 - matching decltype of member function call. * tree.c (cp_tree_equal): Remove COMPONENT_REF special case. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 047d3ba..3ecacbd 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -25216,17 +25216,16 @@ build_deduction_guide (tree ctor, tree outer_args, tsubst_flags_t complain) } else { + ++processing_template_decl; + + tree fn_tmpl + = (TREE_CODE (ctor) == TEMPLATE_DECL ? ctor + : DECL_TI_TEMPLATE (ctor)); if (outer_args) - ctor = tsubst (ctor, outer_args, complain, ctor); + fn_tmpl = tsubst (fn_tmpl, outer_args, complain, ctor); + ctor = DECL_TEMPLATE_RESULT (fn_tmpl); + type = DECL_CONTEXT (ctor); - tree fn_tmpl; - if (TREE_CODE (ctor) == TEMPLATE_DECL) - { - fn_tmpl = ctor; - ctor = DECL_TEMPLATE_RESULT (fn_tmpl); - } - else - fn_tmpl = DECL_TI_TEMPLATE (ctor); tparms = DECL_TEMPLATE_PARMS (fn_tmpl); /* If type is a member class template, DECL_TI_ARGS (ctor) will have @@ -25248,7 +25247,6 @@ build_deduction_guide (tree ctor, tree outer_args, tsubst_flags_t complain) /* For a member template constructor, we need to flatten the two template parameter lists into one, and then adjust the function signature accordingly. This gets...complicated. */ - ++processing_template_decl; tree save_parms = current_template_parms; /* For a member template we should have two levels of parms/args, one @@ -25309,8 +25307,8 @@ build_deduction_guide (tree ctor, tree outer_args, tsubst_flags_t complain) ci = tsubst_constraint_info (ci, tsubst_args, complain, ctor); current_template_parms = save_parms; - --processing_template_decl; } + --processing_template_decl; } if (!memtmpl) |