To match all the other places that pull a _TEMPLATE_PARM out of a
_DECL (get_template_parm_index, etc.).
This change is too small to be legally significant for copyright.
PR c++/114377
gcc/cp/ChangeLog:
* pt.cc (find_template_parameter_info::found): Use TREE_TYPE for
TEMPLATE_DECL instead of DECL_INITIAL.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/class-deduction-alias19.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit
801e82acd6b4f0cf863529875947e394899ea7b9)
{
if (TREE_CODE (parm) == TREE_LIST)
parm = TREE_VALUE (parm);
- if (TREE_CODE (parm) == TYPE_DECL)
+ if (TREE_CODE (parm) == TYPE_DECL
+ || TREE_CODE (parm) == TEMPLATE_DECL)
parm = TREE_TYPE (parm);
else
parm = DECL_INITIAL (parm);
--- /dev/null
+// PR c++/114377
+// { dg-do compile { target c++20 } }
+
+template <template <typename> typename Iterator>
+struct K {};
+
+template <typename C, typename IteratorPolicy>
+class Foo {};
+
+template <typename C, template<typename> typename TTP>
+using Bar = Foo<C, K<TTP>>;
+
+void s() {
+ Bar(1); // { dg-error "failed|no match" }
+}