diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -2122,7 +2122,12 @@ // Add ivar's to class's DeclContext. for (unsigned i = 0, e = numIvars; i != e; ++i) { ivars[i]->setLexicalDeclContext(ImpDecl); - IDecl->makeDeclVisibleInContext(ivars[i]); + // In a 'fragile' runtime the ivar was added to the implicit + // ObjCInterfaceDecl while in a 'non-fragile' runtime the ivar is + // only in the ObjCImplementationDecl. In the non-fragile case the ivar + // therefore also needs to be propagated to the ObjCInterfaceDecl. + if (!LangOpts.ObjCRuntime.isFragile()) + IDecl->makeDeclVisibleInContext(ivars[i]); ImpDecl->addDecl(ivars[i]); }