From 78673b53f111b7f3125541afafe44d2cae06e045 Mon Sep 17 00:00:00 2001 From: chrchr Date: Fri, 6 Oct 2023 11:33:23 +0200 Subject: [PATCH] Fix #12044 FN knownConditionTrueFalse comparing qualified constant with number --- lib/astutils.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/astutils.cpp b/lib/astutils.cpp index d1e92ed93c1..54c724d34a8 100644 --- a/lib/astutils.cpp +++ b/lib/astutils.cpp @@ -1506,8 +1506,12 @@ bool isSameExpression(bool cpp, bool macro, const Token *tok1, const Token *tok2 if (cpp) { if (tok1->str() == "." && tok1->astOperand1() && tok1->astOperand1()->str() == "this") tok1 = tok1->astOperand2(); + while (Token::simpleMatch(tok1, "::") && tok1->astOperand2()) + tok1 = tok1->astOperand2(); if (tok2->str() == "." && tok2->astOperand1() && tok2->astOperand1()->str() == "this") tok2 = tok2->astOperand2(); + while (Token::simpleMatch(tok2, "::") && tok2->astOperand2()) + tok2 = tok2->astOperand2(); } // Skip double not if (Token::simpleMatch(tok1, "!") && Token::simpleMatch(tok1->astOperand1(), "!") && !Token::simpleMatch(tok1->astParent(), "=") && astIsBoolLike(tok2)) {