This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix c++/23307, ICE on invalid
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 10 Aug 2005 10:44:53 +0200 (CEST)
- Subject: [PATCH] Fix c++/23307, ICE on invalid
This fixes the ICE by changing an gcc_assert into returning
error_mark_node. I seriously question the use of asserts
in paths where we might deal with erroneous input.
And I'm inclined to commit this as obvious to mainline in 24h
-- so tell me not to early.
c++/23307 seems to be masked on 4.0.2 20050728 somehow, but the
problem looks latent there, too. So, ok for 4.0?
Richard.
2005-08-10 Richard Guenther <rguenther@suse.de>
PR c++/23307
* parser.c (cp_parser_template_id): Rather than using
gcc_assert, return error_mark_node if it's not like we
expected.
Index: cp/parser.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/parser.c,v
retrieving revision 1.349
diff -c -3 -p -r1.349 parser.c
*** cp/parser.c 22 Jul 2005 07:30:49 -0000 1.349
--- cp/parser.c 10 Aug 2005 08:38:25 -0000
*************** cp_parser_template_id (cp_parser *parser
*** 8655,8663 ****
{
/* If it's not a class-template or a template-template, it should be
a function-template. */
! gcc_assert ((DECL_FUNCTION_TEMPLATE_P (template)
! || TREE_CODE (template) == OVERLOAD
! || BASELINK_P (template)));
template_id = lookup_template_function (template, arguments);
}
--- 8655,8664 ----
{
/* If it's not a class-template or a template-template, it should be
a function-template. */
! if (!(DECL_FUNCTION_TEMPLATE_P (template)
! || TREE_CODE (template) == OVERLOAD
! || BASELINK_P (template)))
! return error_mark_node;
template_id = lookup_template_function (template, arguments);
}