Here the problem was that in order to form a FUNCTION_DECL for foo<int> in
the uninstantiated template, we were trying to deduce template args for S
from the template parm itself, and failing.
* pt.c (do_class_deduction): Handle parm used as its own arg.
From-SVN: r269463
+2019-03-07 Jason Merrill <jason@redhat.com>
+
+ PR c++/88820 - ICE with CTAD and member template used in DMI.
+ * pt.c (do_class_deduction): Handle parm used as its own arg.
+
2019-03-07 Jakub Jelinek <jakub@redhat.com>
PR c++/89585
error ("non-class template %qT used without template arguments", tmpl);
return error_mark_node;
}
+ if (init && TREE_TYPE (init) == ptype)
+ /* Using the template parm as its own argument. */
+ return ptype;
tree type = TREE_TYPE (tmpl);
--- /dev/null
+// PR c++/88820
+// { dg-do compile { target c++17 } }
+
+template <int> struct S;
+
+template <S> struct W {
+ template <typename> static int foo();
+ bool b = foo<int>();
+};