This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] [PR13810] ICE on default argument for template template parameter (3.4/3.5 regression)
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: "Giovanni Bajo" <giovannibajo at libero dot it>
- Cc: <gcc-patches at gcc dot gnu dot org>, "Mark Mitchell" <mark at codesourcery dot com>
- Date: 24 Jan 2004 02:19:49 +0100
- Subject: Re: [C++ PATCH] [PR13810] ICE on default argument for template template parameter (3.4/3.5 regression)
- Organization: Integrable Solutions
- References: <153401c3e1aa$bb4c3710$62b92997@bagio>
"Giovanni Bajo" <giovannibajo@libero.it> writes:
| Moreover, check_template_template_default_arg was accepting TYPE_DECL as a
| valid default argument. I can't see how that could have ever been correct. I
| fixed it and also provided more detailed diagnostics for common cases.
[...]
| --- 1942,1967 ----
| {
| if (TREE_CODE (argument) != TEMPLATE_DECL
| && TREE_CODE (argument) != TEMPLATE_TEMPLATE_PARM
| && TREE_CODE (argument) != UNBOUND_CLASS_TEMPLATE)
| {
| ! if (TREE_CODE (argument) == TYPE_DECL)
| ! {
| ! tree t = TREE_TYPE (argument);
| !
| ! /* Try to emit a slightly smarter error message if we detect
| ! that the user is using a template instantiation. */
| ! if (CLASSTYPE_TEMPLATE_INFO (t)
| ! && CLASSTYPE_TEMPLATE_INSTANTIATION (t))
| ! error ("`%D' is a template instantiation and cannot be used as a "
| ! "default argument for a template template parameter",
consider:
error ("invalid use of type '%T' used as default value "
"for a template template-parameter",
Please, notice the use of '%T' instead of '%D'.
| ! argument);
| ! else
| ! error ("`%D' is not a template class and cannot be used as a "
| ! "default argument for a template template parameter",
| ! argument);
error ("invalid use of '%D' as default value for a template "
"template-argument", argument)
The point being that in the near future
template<class> class TTP
may not just means that TTTP ought to be a template /class/; it may
just be a template alias. And the diagnostic is just as clear.
-- Gaby