This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ PATCH: PR c++/16971


This patch fixes PR c++/16971, an ICE-after-valid regression on the
mainline.

Tested on i686-pc-linux-gnu, applied on the mainline.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2004-08-10  Mark Mitchell  <mark@codesourcery.com>

	    PR c++/16971
	    * parser.c (cp_parser_init_declarator): Robustify.

2004-08-10  Mark Mitchell  <mark@codesourcery.com>

	    PR c++/16971
	    * g++.dg/parse/crash16.C: New test.

Index: cp/parser.c
===================================================================
RCS file: /home/gcc/repos/gcc/gcc/gcc/cp/parser.c,v
retrieving revision 1.232
diff -c -5 -p -r1.232 parser.c
*** cp/parser.c	4 Aug 2004 05:27:50 -0000	1.232
--- cp/parser.c	10 Aug 2004 23:17:10 -0000
*************** cp_parser_init_declarator (cp_parser* pa
*** 10700,10710 ****
  	cp_parser_save_default_args (parser, decl);
      }
  
    /* Finish processing the declaration.  But, skip friend
       declarations.  */
!   if (!friend_p && decl)
      {
        cp_finish_decl (decl,
  		      initializer,
  		      asm_specification,
  		      /* If the initializer is in parentheses, then this is
--- 10700,10710 ----
  	cp_parser_save_default_args (parser, decl);
      }
  
    /* Finish processing the declaration.  But, skip friend
       declarations.  */
!   if (!friend_p && decl && decl != error_mark_node)
      {
        cp_finish_decl (decl,
  		      initializer,
  		      asm_specification,
  		      /* If the initializer is in parentheses, then this is

New test:

// PR c++/16971

namespace N {
  int i; // { dg-error "" }
  // By checking for an explicit keyword on the next line we avoid
  // matching an ICE message.
  int i; // { dg-error "redefinition" }
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]