From cfb825648d585d15149c8e7658757ae9fc402b33 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 20 Feb 2017 01:05:31 -0500 Subject: [PATCH] PR c++/79500 - ICE with non-template deduction guide * pt.c (do_class_deduction): Use STRIP_TEMPLATE rather than DECL_TEMPLATE_RESULT. From-SVN: r245588 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/pt.c | 4 ++-- gcc/testsuite/g++.dg/cpp1z/class-deduction29.C | 6 ++++++ 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp1z/class-deduction29.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 79fee99c4f3..ee222b43e0d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2017-02-19 Jason Merrill + PR c++/79500 - ICE with non-template deduction guide + * pt.c (do_class_deduction): Use STRIP_TEMPLATE rather than + DECL_TEMPLATE_RESULT. + PR c++/79580 - ICE with compound literal * parser.c (cp_parser_class_head): If we're in the middle of an expression, use ts_within_enclosing_non_class. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 9e6ce8d51de..46e64986491 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -25118,7 +25118,7 @@ do_class_deduction (tree ptype, tree tmpl, tree init, int flags, { tree t = cands; for (; t; t = OVL_NEXT (t)) - if (DECL_NONCONVERTING_P (DECL_TEMPLATE_RESULT (OVL_CURRENT (t)))) + if (DECL_NONCONVERTING_P (STRIP_TEMPLATE (OVL_CURRENT (t)))) break; if (t) { @@ -25126,7 +25126,7 @@ do_class_deduction (tree ptype, tree tmpl, tree init, int flags, for (t = cands; t; t = OVL_NEXT (t)) { tree f = OVL_CURRENT (t); - if (!DECL_NONCONVERTING_P (DECL_TEMPLATE_RESULT (f))) + if (!DECL_NONCONVERTING_P (STRIP_TEMPLATE (f))) pruned = build_overload (f, pruned); } cands = pruned; diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction29.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction29.C new file mode 100644 index 00000000000..efffe3d10f6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction29.C @@ -0,0 +1,6 @@ +// PR c++/79500 +// { dg-options -std=c++1z } + +template struct A {}; +A(...) -> A; +A a = {}; -- 2.30.2