Index: include/clang/Sema/Sema.h =================================================================== --- include/clang/Sema/Sema.h +++ include/clang/Sema/Sema.h @@ -6470,6 +6470,8 @@ bool CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams); + void CheckCXXRecordDecl(CXXRecordDecl *Record, CXXRecordDecl *Prev); + /// Called when the parser has parsed a C++ typename /// specifier, e.g., "typename T::type". /// Index: lib/Sema/SemaTemplate.cpp =================================================================== --- lib/Sema/SemaTemplate.cpp +++ lib/Sema/SemaTemplate.cpp @@ -7076,6 +7076,21 @@ << TemplateParams->getSourceRange(); } +void Sema::CheckCXXRecordDecl(CXXRecordDecl *Record, CXXRecordDecl *Prev) +{ + if (Prev && Prev->hasAttr()) { + MSInheritanceAttr::Spelling IM = Prev->getMSInheritanceModel(); + Record->addAttr(MSInheritanceAttr::CreateImplicit( + getASTContext(), IM, + /*BestCase=*/MSPointerToMemberRepresentationMethod == + LangOptions::PPTMK_BestCase, + ImplicitMSInheritanceAttrLoc.isValid() + ? ImplicitMSInheritanceAttrLoc + : Record->getSourceRange())); + Consumer.AssignInheritanceModel(Record); + } +} + /// Determine what kind of template specialization the given declaration /// is. static TemplateSpecializationKind getTemplateSpecializationKind(Decl *D) { Index: lib/Sema/SemaTemplateInstantiateDecl.cpp =================================================================== --- lib/Sema/SemaTemplateInstantiateDecl.cpp +++ lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -1551,6 +1551,8 @@ LocalInstantiations.perform(); } + SemaRef.CheckCXXRecordDecl(Record, PrevDecl); + SemaRef.DiagnoseUnusedNestedTypedefs(Record); return Record;