diff options
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 3 | ||||
-rw-r--r-- | test/SemaObjC/blocks.m | 11 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index 65611f2e58..f66ee1e30f 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -693,7 +693,8 @@ Sema::ActOnObjCForCollectionStmt(SourceLocation ForLoc, FirstType = static_cast<Expr*>(First)->getType(); } - if (!FirstType->isObjCObjectPointerType()) + if (!FirstType->isObjCObjectPointerType() && + !FirstType->isBlockPointerType()) Diag(ForLoc, diag::err_selector_element_type) << FirstType << First->getSourceRange(); } diff --git a/test/SemaObjC/blocks.m b/test/SemaObjC/blocks.m index 6dab289ae9..aecdfd1f5e 100644 --- a/test/SemaObjC/blocks.m +++ b/test/SemaObjC/blocks.m @@ -44,3 +44,14 @@ void foo8() { P = ^itf() {}; // expected-error {{Objective-C interface type 'itf' cannot be returned by value}} P = ^itf{}; // expected-error {{Objective-C interface type 'itf' cannot be returned by value}} } + + +int foo9() { + typedef void (^DVTOperationGroupScheduler)(); + id _suboperationSchedulers; + + for (DVTOperationGroupScheduler scheduler in _suboperationSchedulers) { + ; + } + +} |