This function needs to handle this case like convert_template_argument.
PR c++/58538
gcc/cp/ChangeLog:
* semantics.cc (check_template_template_default_arg): Check
maybe_get_template_decl_from_type_decl.
gcc/testsuite/ChangeLog:
* g++.dg/template/ttp7.C: Remove expected error.
&& TREE_CODE (argument) != UNBOUND_CLASS_TEMPLATE)
{
if (TREE_CODE (argument) == TYPE_DECL)
- error ("invalid use of type %qT as a default value for a template "
- "template-parameter", TREE_TYPE (argument));
+ {
+ if (tree t = maybe_get_template_decl_from_type_decl (argument))
+ if (TREE_CODE (t) == TEMPLATE_DECL)
+ return t;
+ error ("invalid use of type %qT as a default value for a template "
+ "template-parameter", TREE_TYPE (argument));
+ }
else
error ("invalid default argument for a template template parameter");
return error_mark_node;
template <typename T>
struct S {
- template <template <typename> class = S> struct I1 {}; // { dg-error "as a default value" }
+ template <template <typename> class = S> struct I1 {}; // PR c++/58538
template <template <typename> class = ::S> struct I2 {};
};