From d340e8770c5ff0d9d2408f25d34c2de2805bdaa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 8 Dec 2020 17:39:04 +0100 Subject: [PATCH] Fixed Tokenizer::setVarId when removing last scope name --- lib/tokenize.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 4c5fd7a3b..b0e37ffaf 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -3838,9 +3838,11 @@ void Tokenizer::setVarIdPass2() baseClassName = name; break; } - if (scopeName3.size() < 8) + // Remove last scope name + if (scopeName3.size() <= 8) break; - const std::string::size_type pos = scopeName3.rfind(" :: ", scopeName.size()-5); + scopeName3.erase(scopeName3.size() - 4); + const std::string::size_type pos = scopeName3.rfind(" :: "); if (pos == std::string::npos) break; scopeName3.erase(pos + 4);