@@ -2446,17 +2446,19 @@ bool Type::isIncompleteType(NamedDecl **Def) const {
24462446 // Member pointers in the MS ABI have special behavior in
24472447 // RequireCompleteType: they attach a MSInheritanceAttr to the CXXRecordDecl
24482448 // to indicate which inheritance model to use.
2449- // The inheritance attribute might only be present on the most recent
2450- // CXXRecordDecl.
2451- const CXXRecordDecl *RD =
2452- cast<MemberPointerType>(CanonicalType)->getMostRecentCXXRecordDecl ();
2449+ auto *MPTy = cast<MemberPointerType>(CanonicalType);
2450+ const Type *ClassTy = MPTy->getClass ();
24532451 // Member pointers with dependent class types don't get special treatment.
2454- if (!RD )
2452+ if (ClassTy-> isDependentType () )
24552453 return false ;
2454+ const CXXRecordDecl *RD = ClassTy->getAsCXXRecordDecl ();
24562455 ASTContext &Context = RD->getASTContext ();
24572456 // Member pointers not in the MS ABI don't get special treatment.
24582457 if (!Context.getTargetInfo ().getCXXABI ().isMicrosoft ())
24592458 return false ;
2459+ // The inheritance attribute might only be present on the most recent
2460+ // CXXRecordDecl, use that one.
2461+ RD = RD->getMostRecentNonInjectedDecl ();
24602462 // Nothing interesting to do if the inheritance attribute is already set.
24612463 if (RD->hasAttr <MSInheritanceAttr>())
24622464 return false ;
@@ -4711,8 +4713,7 @@ LinkageInfo LinkageComputer::computeTypeLinkageInfo(const Type *T) {
47114713 return computeTypeLinkageInfo (cast<ReferenceType>(T)->getPointeeType ());
47124714 case Type::MemberPointer: {
47134715 const auto *MPT = cast<MemberPointerType>(T);
4714- LinkageInfo LV =
4715- getDeclLinkageAndVisibility (MPT->getMostRecentCXXRecordDecl ());
4716+ LinkageInfo LV = computeTypeLinkageInfo (MPT->getClass ());
47164717 LV.merge (computeTypeLinkageInfo (MPT->getPointeeType ()));
47174718 return LV;
47184719 }
@@ -5178,10 +5179,7 @@ QualType::DestructionKind QualType::isDestructedTypeImpl(QualType type) {
51785179}
51795180
51805181CXXRecordDecl *MemberPointerType::getMostRecentCXXRecordDecl () const {
5181- auto *RD = getClass ()->getAsCXXRecordDecl ();
5182- if (!RD)
5183- return nullptr ;
5184- return RD->getMostRecentNonInjectedDecl ();
5182+ return getClass ()->getAsCXXRecordDecl ()->getMostRecentNonInjectedDecl ();
51855183}
51865184
51875185void clang::FixedPointValueToString (SmallVectorImpl<char > &Str,
0 commit comments