Commit ae9b2892 by Jason Merrill Committed by Jason Merrill

PR c++/88820 - ICE with CTAD and member template used in DMI.

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
parent 1738b522
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
......
......@@ -27184,6 +27184,9 @@ do_class_deduction (tree ptype, tree tmpl, tree init, int flags,
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);
......
// 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>();
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment