================
@@ -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()) {
----------------
asavonic wrote:

> Is the issue here that now additional cases are called from 
> `mergeMaybeWithVisibility`.

Yes. Starting from `LinkageInfo fromLV = from->getLinkageAndVisibility();` we 
eventually reach

```
if (const auto *spec = dyn_cast<ClassTemplateSpecializationDecl>(Tag)) {
  mergeTemplateLV(LV, spec, computation);
```
where spec is:
```
ClassTemplatePartialSpecializationDecl 0x55555571ebf0 <repro.cpp:24:1, 
line:29:1> line:25:8 struct DecayedFunctorTraits definition 
explicit_specialization
[...]
|-TemplateArgument type 'type-parameter-0-0 (type-parameter-0-1::*)()'
| `-MemberPointerType 0x55555571ea90 'type-parameter-0-0 
(type-parameter-0-1::*)()' dependent
|   |-TemplateTypeParmType 0x5555556f73b0 'type-parameter-0-1' dependent depth 
0 index 1
|   `-FunctionProtoType 0x55555571e9e0 'type-parameter-0-0 ()' dependent cdecl
|     `-TemplateTypeParmType 0x5555556f7630 'type-parameter-0-0' dependent 
depth 0 index 0
[...]
```

> How can we have a case where there is no record decl for a member pointer?

MemberPointerType seems to be both for data members or functions. Or I guess it 
can be neither if is a template parameter? (see test75)
https://github.com/llvm/llvm-project/blob/cfeaa395970b7a2a2f0389d06a20d0970d591807/clang/include/clang/AST/Type.h#L3567

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

Reply via email to