diff options
-rw-r--r-- | lib/AST/ASTContext.cpp | 3 | ||||
-rw-r--r-- | test/CodeGenObjCXX/foreach-statement.mm | 10 |
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 851f8d1c68..60d7117bbf 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -2856,6 +2856,9 @@ QualType ASTContext::getObjCFastEnumerationStateType() { Field->setAccess(AS_public); ObjCFastEnumerationStateTypeDecl->addDecl(Field); } + if (getLangOptions().CPlusPlus) + if (CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(ObjCFastEnumerationStateTypeDecl)) + CXXRD->setEmpty(false); ObjCFastEnumerationStateTypeDecl->completeDefinition(); } diff --git a/test/CodeGenObjCXX/foreach-statement.mm b/test/CodeGenObjCXX/foreach-statement.mm new file mode 100644 index 0000000000..d0ad5b3a8f --- /dev/null +++ b/test/CodeGenObjCXX/foreach-statement.mm @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s +// rdar: // 8027844 + +// CHECK: call void @llvm.memset + +int main() { + id foo; + for (id a in foo) { + } +} |