File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -661,7 +661,9 @@ class CollectExtraHighlightings
661661 }
662662
663663 bool VisitCXXMemberCallExpr (CXXMemberCallExpr *CE) {
664- if (isa<CXXDestructorDecl>(CE->getMethodDecl ())) {
664+ // getMethodDecl can return nullptr with member pointers, e.g.
665+ // `(foo.*pointer_to_member_fun)(arg);`
666+ if (isa_and_present<CXXDestructorDecl>(CE->getMethodDecl ())) {
665667 if (auto *ME = dyn_cast<MemberExpr>(CE->getCallee ())) {
666668 if (auto *TI = ME->getMemberNameInfo ().getNamedTypeInfo ()) {
667669 H.addExtraModifier (TI->getTypeLoc ().getBeginLoc (),
Original file line number Diff line number Diff line change @@ -887,6 +887,17 @@ sizeof...($TemplateParameter[[Elements]]);
887887 $TemplateParameter[[T]] $Variable_def[[x]] = {};
888888 template <>
889889 int $Variable_def[[x]]<int> = (int)sizeof($Class[[Base]]);
890+ )cpp" ,
891+ // no crash
892+ R"cpp(
893+ struct $Class_def[[Foo]] {
894+ void $Method_decl[[foo]]();
895+ };
896+
897+ void $Function_def[[s]]($Class[[Foo]] $Parameter_def[[f]]) {
898+ auto $LocalVariable_def[[k]] = &$Class[[Foo]]::$Method[[foo]];
899+ ($Parameter[[f]].*$LocalVariable[[k]])(); // no crash on VisitCXXMemberCallExpr
900+ }
890901 )cpp" };
891902 for (const auto &TestCase : TestCases)
892903 // Mask off scope modifiers to keep the tests manageable.
You can’t perform that action at this time.
0 commit comments