diff options
-rw-r--r-- | clang/Sema/SemaStmt.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/clang/Sema/SemaStmt.cpp b/clang/Sema/SemaStmt.cpp index 81eb0b0060f..ab40e708e36 100644 --- a/clang/Sema/SemaStmt.cpp +++ b/clang/Sema/SemaStmt.cpp @@ -543,14 +543,9 @@ Sema::ActOnObjcForCollectionStmt(SourceLocation ForColLoc, FirstType = cast<ValueDecl>(DS->getDecl())->getType(); // C99 6.8.5p3: The declaration part of a 'for' statement shall only declare // identifiers for objects having storage class 'auto' or 'register'. - for (ScopedDecl *D = DS->getDecl(); D; D = D->getNextDeclarator()) { - BlockVarDecl *BVD = cast<BlockVarDecl>(D); - if (BVD && !BVD->hasLocalStorage()) - BVD = 0; - if (BVD == 0) - return Diag(cast<ScopedDecl>(D)->getLocation(), - diag::err_non_variable_decl_in_for); - } + BlockVarDecl *BVD = cast<BlockVarDecl>(DS->getDecl()); + if (!BVD->hasLocalStorage()) + return Diag(BVD->getLocation(), diag::err_non_variable_decl_in_for); } else FirstType = static_cast<Expr*>(first)->getType(); |