diff options
author | Jason Merrill <jason@redhat.com> | 2023-03-14 23:16:21 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2023-03-15 08:44:43 -0400 |
commit | 40c1352c5a4530350012d6a922435cf491663daa (patch) | |
tree | 52af17c72a9a18fb0517ec1aaab11b035f26b66b /gcc/cp | |
parent | 3ea64aad06a2b32739028bae03b9b9a5691d2d30 (diff) | |
download | gcc-40c1352c5a4530350012d6a922435cf491663daa.zip gcc-40c1352c5a4530350012d6a922435cf491663daa.tar.gz gcc-40c1352c5a4530350012d6a922435cf491663daa.tar.bz2 |
c++: injected class name as default ttp arg [PR58538]
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.
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/semantics.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc index d67a9b2..57dd7b6 100644 --- a/gcc/cp/semantics.cc +++ b/gcc/cp/semantics.cc @@ -3468,8 +3468,13 @@ check_template_template_default_arg (tree argument) && 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; |