================ @@ -4787,8 +4787,10 @@ LinkageInfo LinkageComputer::computeTypeLinkageInfo(const Type *T) { return computeTypeLinkageInfo(cast<ReferenceType>(T)->getPointeeType()); case Type::MemberPointer: { const auto *MPT = cast<MemberPointerType>(T); - LinkageInfo LV = - getDeclLinkageAndVisibility(MPT->getMostRecentCXXRecordDecl()); + LinkageInfo LV; + if (CXXRecordDecl *D = MPT->getMostRecentCXXRecordDecl()) { ---------------- erichkeane wrote:
> > Should we be taking visibility from that `getClass` in this case? It is a > > dependent expression in this case, but perhaps we should be? > > I don't know how to construct a test case where a dependent class has > visibility or linkage. We can do the following, but probably shouldn't unless > there is a test case: > > ```diff > diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp > index 5783f8701273..951249b8c495 100644 > --- a/clang/lib/AST/Type.cpp > +++ b/clang/lib/AST/Type.cpp > @@ -4790,6 +4790,8 @@ LinkageInfo > LinkageComputer::computeTypeLinkageInfo(const Type *T) { > LinkageInfo LV; > if (CXXRecordDecl *D = MPT->getMostRecentCXXRecordDecl()) { > LV.merge(getDeclLinkageAndVisibility(D)); > + } else if (const Type *Ty = MPT->getQualifier()->getAsType()) { > + LV.merge(computeTypeLinkageInfo(Ty)); > } > LV.merge(computeTypeLinkageInfo(MPT->getPointeeType())); > return LV; > ``` I'm sympathetic to the 'don't unless there is a test case', but I'm leaning the other way: we should get this as right as we can, even if we don't know what a reproducer looks like. https://github.com/llvm/llvm-project/pull/136689 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits