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
661
661
}
662
662
663
663
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 ())) {
665
667
if (auto *ME = dyn_cast<MemberExpr>(CE->getCallee ())) {
666
668
if (auto *TI = ME->getMemberNameInfo ().getNamedTypeInfo ()) {
667
669
H.addExtraModifier (TI->getTypeLoc ().getBeginLoc (),
Original file line number Diff line number Diff line change @@ -887,6 +887,17 @@ sizeof...($TemplateParameter[[Elements]]);
887
887
$TemplateParameter[[T]] $Variable_def[[x]] = {};
888
888
template <>
889
889
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
+ }
890
901
)cpp" };
891
902
for (const auto &TestCase : TestCases)
892
903
// Mask off scope modifiers to keep the tests manageable.
You can’t perform that action at this time.
0 commit comments