Comments
Patch
===================================================================
@@ -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))
===================================================================
@@ -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 } */
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.