DECL_TEMPLATE_RESULT doesn't work on a non-template, so let's use STRIP_TEMPLATE instead.
Tested x86_64-pc-linux-gnu, applying to trunk.
commit 9f99104a12b72006253c0ce5f0b046ada82eb354 Author: Jason Merrill <ja...@redhat.com> Date: Sun Feb 19 14:01:51 2017 -0800 PR c++/79500 - ICE with non-template deduction guide * pt.c (do_class_deduction): Use STRIP_TEMPLATE rather than DECL_TEMPLATE_RESULT. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 9e6ce8d..46e6498 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 0000000..efffe3d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction29.C @@ -0,0 +1,6 @@ +// PR c++/79500 +// { dg-options -std=c++1z } + +template<typename T> struct A {}; +A(...) -> A<int>; +A a = {};