From: Fariborz Jahanian Date: Fri, 14 Aug 2009 21:53:27 +0000 (+0000) Subject: objc2's foreach statement's selector type can be X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a5e42a82ce055f29f3733f3a1f10da6cb9877dee;p=clang objc2's foreach statement's selector type can be a block pointer too. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79050 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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(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) { + ; + } + +}