Index: lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp +++ lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp @@ -39,7 +39,7 @@ // TODO: Handle other methods, such as .get() or .release(). // But once we do, we'd need a visitor to explain null dereferences // that are found via such modeling. - const auto *CD = dyn_cast(Call->getDecl()); + const auto *CD = dyn_cast_or_null(Call->getDecl()); return CD && CD->getConversionType()->isBooleanType(); } Index: test/Analysis/smart-ptr.cpp =================================================================== --- test/Analysis/smart-ptr.cpp +++ test/Analysis/smart-ptr.cpp @@ -16,3 +16,13 @@ // TODO: Report a null dereference (instead). *P.get() = 1; // expected-warning {{Method called on moved-from object 'P'}} } + +// Don't crash when attempting to model a call with unknown callee. +namespace testUnknownCallee { +struct S { + void foo(); +}; +void bar(S *s, void (S::*func)(void)) { + (s->*func)(); // no-crash +} +} // namespace testUnknownCallee