c++: alias CTAD and template template parm [PR114377]
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>
This commit is contained in:
parent
ca56b43105
commit
801e82acd6
2 changed files with 17 additions and 1 deletions
|
@ -11032,7 +11032,8 @@ find_template_parameter_info::found (tree parm)
|
|||
{
|
||||
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);
|
||||
|
|
15
gcc/testsuite/g++.dg/cpp2a/class-deduction-alias19.C
Normal file
15
gcc/testsuite/g++.dg/cpp2a/class-deduction-alias19.C
Normal file
|
@ -0,0 +1,15 @@
|
|||
// 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" }
|
||||
}
|
Loading…
Add table
Reference in a new issue