Index: lib/StaticAnalyzer/Core/CallEvent.cpp =================================================================== --- lib/StaticAnalyzer/Core/CallEvent.cpp +++ lib/StaticAnalyzer/Core/CallEvent.cpp @@ -425,6 +425,9 @@ SVal ThisVal = getCXXThisVal(); Values.push_back(ThisVal); + if (ThisVal.isUnknown()) + return; + // Don't invalidate if the method is const and there are no mutable fields. if (const CXXMethodDecl *D = cast_or_null(getDecl())) { if (!D->isConst()) Index: test/Analysis/const-method-call.cpp =================================================================== --- test/Analysis/const-method-call.cpp +++ test/Analysis/const-method-call.cpp @@ -204,6 +204,28 @@ s2().f(0); } +// --- PR25392 --- // + +struct x0; +template struct x1 { + typedef x0 x2; +}; + +template struct x5 { +public: + typename x1::x2 operator[](int) {} // expected-warning {{control reaches end of non-void function}} +}; + +struct x0 { +public: + template void x6() const; + x5 x7; +} x8; + +void x9() { + x8.x7[0].x6 >(); // expected-note {{in instantiation of member function 'x5::operator[]' requested here}} +} + // FIXME // When there is a circular reference to an object and a const method is called // the object is not invalidated because TK_PreserveContents has already been