diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index e50762e15..2150d234c 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -1056,7 +1056,7 @@ void CheckClass::privateFunctions() bool used = checkFunctionUsage(privateFuncs.front(), scope); // Usage in this class // Check in friend classes const std::vector& friendList = scope->definedType->friendList; - for (size_t i = 0; i < friendList.size(); i++) { + for (size_t i = 0; i < friendList.size() && !used; i++) { if (friendList[i].type) used = checkFunctionUsage(privateFuncs.front(), friendList[i].type->classScope); else