Catch a foreach parse error.

llvm-svn: 62382
This commit is contained in:
Fariborz Jahanian 2009-01-17 00:00:40 +00:00
parent fbfaafc0a9
commit 94234ea63e
2 changed files with 12 additions and 0 deletions

View File

@ -364,6 +364,11 @@ ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D) {
if (Tok.is(tok::semi)) {
ConsumeToken();
// for(is key; in keys) is error.
if (D.getContext() == Declarator::ForContext && isTokIdentifier_in()) {
Diag(Tok, diag::err_parse_error);
return 0;
}
return Actions.FinalizeDeclaratorGroup(CurScope, LastDeclInGroup);
}
// If this is an ObjC2 for-each loop, this is a successful declarator

View File

@ -0,0 +1,7 @@
// RUN: clang -fsyntax-only -verify %s
static int test_NSURLGetResourceValueForKey( id keys )
{
for ( id key; in keys) { // expected-error {{parse error}}
}
}