diff options
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 2 | ||||
| -rw-r--r-- | clang/test/SemaObjC/continuation-class-err.m | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 87bcfe9127d..6ace744fc30 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -9045,6 +9045,8 @@ Decl *Sema::ActOnIvar(Scope *S, : ObjCIvarDecl::None; // Must set ivar's DeclContext to its enclosing interface. ObjCContainerDecl *EnclosingDecl = cast<ObjCContainerDecl>(CurContext); + if (!EnclosingDecl || EnclosingDecl->isInvalidDecl()) + return 0; ObjCContainerDecl *EnclosingContext; if (ObjCImplementationDecl *IMPDecl = dyn_cast<ObjCImplementationDecl>(EnclosingDecl)) { diff --git a/clang/test/SemaObjC/continuation-class-err.m b/clang/test/SemaObjC/continuation-class-err.m index 700cf61eedb..ad8b90955fa 100644 --- a/clang/test/SemaObjC/continuation-class-err.m +++ b/clang/test/SemaObjC/continuation-class-err.m @@ -40,3 +40,12 @@ @synthesize fee = _fee; @end +// rdar://10752081 +@interface MyOtherClass() // expected-error {{cannot find interface declaration for 'MyOtherClass'}} +{ + id array; +} +@end + +@implementation MyOtherClass // expected-warning {{cannot find interface declaration for 'MyOtherClass'}} +@end |

