diff mbox

ObjC++ bugfix for PR objc++/23707

Message ID 1286297113.156221415@192.168.2.231
State New
Headers show

Commit Message

Nicola Pero Oct. 5, 2010, 4:45 p.m. UTC
This patch (to be applied on top of the other chunk of ObjC++ bugfixes I sent earlier) fixes PR objc++/23707
(internal compiler error when a method declaration is suddenly interrupted).

Ok to apply ?

Thanks

gcc/cp/ChangeLog:

2010-10-05  Nicola Pero  <nicola.pero@meta-innovation.com>

        PR objc++/23707
        * parser.c (cp_parser_objc_method_keyword_params): If the required
        colon is not found while parsing parameters, stop parsing them.

gcc/testsuite/obj-c++/ChangeLog:

2010-10-05  Nicola Pero  <nicola.pero@meta-innovation.com>

        PR objc++/23707
        * obj-c++.dg/syntax-error.9.mm: New.

Comments

Mike Stump Oct. 5, 2010, 5:20 p.m. UTC | #1
On Oct 5, 2010, at 9:45 AM, Nicola Pero wrote:
> This patch (to be applied on top of the other chunk of ObjC++ bugfixes I sent earlier) fixes PR objc++/23707
> (internal compiler error when a method declaration is suddenly interrupted).
> 
> Ok to apply ?

Ok.
diff mbox

Patch

Index: parser.c
===================================================================
--- parser.c    (revision 164989)
+++ parser.c    (working copy)
@@ -21482,7 +21491,12 @@  cp_parser_objc_method_keyword_params (cp_parser* p
        }
 
       maybe_unary_selector_p = false;
-      cp_parser_require (parser, CPP_COLON, RT_COLON);
+      if (!cp_parser_require (parser, CPP_COLON, RT_COLON))
+       {
+         /* Something went quite wrong.  There should be a colon
+            here, but there is not.  Stop parsing parameters.  */
+         break;
+       }
       type_name = cp_parser_objc_typename (parser);
       /* New ObjC allows attributes on parameters too.  */
       if (cp_lexer_next_token_is_keyword (parser->lexer, RID_ATTRIBUTE))

Index: obj-c++.dg/syntax-error-9.mm
===================================================================
--- obj-c++.dg/syntax-error-9.mm        (revision 0)
+++ obj-c++.dg/syntax-error-9.mm        (revision 0)
@@ -0,0 +1,3 @@ 
+@implementation SaturnDoc /* { dg-warning "cannot find interface declaration" } */
+- read: (void*)aStream ggg /* { dg-error "expected .:. at end of input" } */
+/* { dg-error "expected ..end. at end of input" "" { target *-*-* } 2 } */