From bf335217cd985b114abda817d363193db3a20099 Mon Sep 17 00:00:00 2001 From: Alexander Mai Date: Sun, 30 Mar 2014 08:31:02 +0200 Subject: [PATCH] Fix #5605 part 2 - now endless recursion within CheckClass::isMemberFunc() --- lib/checkclass.cpp | 2 +- test/testclass.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 020813196..8480731de 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -1697,7 +1697,7 @@ bool CheckClass::isMemberFunc(const Scope *scope, const Token *tok) const const Type *derivedFrom = scope->definedType->derivedFrom[i].type; // find the function in the base class - if (derivedFrom && derivedFrom->classScope) { + if (derivedFrom && derivedFrom->classScope && !derivedFrom->hasCircularDependencies()) { if (isMemberFunc(derivedFrom->classScope, tok)) return true; } diff --git a/test/testclass.cpp b/test/testclass.cpp index f8f2bf1d6..c7bd7c419 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -4801,6 +4801,13 @@ private: " return 0;\n" "}"); ASSERT_EQUALS("[test.cpp:4] -> [test.cpp:2]: (performance, inconclusive) Technically the member function 'MixerParticipant::GetAudioFrame' can be static.\n", errout.str()); + + checkConst("class MixerParticipant : public MixerParticipant {\n" + " bool InitializeFileReader() {\n" + " printf(\"music\");\n" + " }\n" + "};"); + ASSERT_EQUALS("[test.cpp:2]: (performance, inconclusive) Technically the member function 'MixerParticipant::InitializeFileReader' can be static.\n", errout.str()); }