This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] Fix 21903
Tom Tromey wrote:
I am not sure that this patch causes the failure that I am seeing,
but as the failure occurs in cp_parser_late_parsing_default_args, it
seems like a likely suspect.
The failure occurs building libjava on x86 FC2, see appended.
fixed thusly, sorry for the inconvenience.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
2005-06-07 Nathan Sidwell <nathan@codesourcery.com>
* parser.c (cp_parser_late_parsing_default_args): Fix overeager
assert in previous patch.
2005-06-07 Nathan Sidwell <nathan@codesourcery.com>
* g++.dg/parse/defarg10.C: New.
Index: cp/parser.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/parser.c,v
retrieving revision 1.337
diff -c -3 -p -r1.337 parser.c
*** cp/parser.c 6 Jun 2005 17:29:36 -0000 1.337
--- cp/parser.c 7 Jun 2005 08:40:57 -0000
*************** cp_parser_late_parsing_default_args (cp_
*** 15599,15605 ****
if (!default_arg)
continue;
! gcc_assert (TREE_CODE (default_arg) == DEFAULT_ARG);
/* Push the saved tokens for the default argument onto the parser's
lexer stack. */
--- 15599,15608 ----
if (!default_arg)
continue;
! if (TREE_CODE (default_arg) != DEFAULT_ARG)
! /* This can happen for a friend declaration for a function
! already declared with default arguments. */
! continue;
/* Push the saved tokens for the default argument onto the parser's
lexer stack. */
Index: testsuite/g++.dg/parse/defarg10.C
===================================================================
RCS file: testsuite/g++.dg/parse/defarg10.C
diff -N testsuite/g++.dg/parse/defarg10.C
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/parse/defarg10.C 7 Jun 2005 08:40:57 -0000
***************
*** 0 ****
--- 1,11 ----
+ // Copyright (C) 2005 Free Software Foundation, Inc.
+ // Contributed by Nathan Sidwell 7 Jun 2005 <nathan@codesourcery.com>
+
+ // From java library.
+
+ void Foo (int = 0);
+
+ class Class
+ {
+ friend void Foo (int);
+ };