From 771cbcf9aef6bedbdda2626bbd0c9fa0df240bc5 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 25 Sep 2026 16:32:22 +0200 Subject: [PATCH 1/4] Update testcondition.cpp --- test/testcondition.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/testcondition.cpp b/test/testcondition.cpp index c7f39584939..d8fe988db35 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -3449,6 +3449,12 @@ class TestCondition : public TestFixture { "}\n"); ASSERT_EQUALS("", errout_str()); + check("std::string a[3];\n" // #15065 + "void f() {\n" + " if (a) {}\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:3:8]: (style) Condition 'a' is always true [knownConditionTrueFalse]\n", errout_str()); + // Avoid FP when condition comes from macro check("#define NOT !\n" "void f() {\n" From 986b820aebd573c7feaaabc6c7cf9761c9262f2a Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 25 Sep 2026 16:33:19 +0200 Subject: [PATCH 2/4] Update valueflow.cpp --- lib/valueflow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index aa0b2c91c29..692dd6b3380 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -1169,7 +1169,7 @@ static void valueFlowImpossibleValues(TokenList& tokenList, const Settings& sett value.setImpossible(); setTokenValue(tok, std::move(value), settings); } else if (tok->variable() && tok->variable()->isArray() && !tok->variable()->isArgument() && - !tok->variable()->isStlType()) { + tok->variable()->getTypeName() != "std::array") {) { ValueFlow::Value value{0}; value.setImpossible(); setTokenValue(tok, std::move(value), settings); From d7c5c57b7320113024000807fb40f38c9d32d7a2 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 25 Sep 2026 16:45:00 +0200 Subject: [PATCH 3/4] Update valueflow.cpp --- lib/valueflow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 692dd6b3380..4a465172dcf 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -1169,7 +1169,7 @@ static void valueFlowImpossibleValues(TokenList& tokenList, const Settings& sett value.setImpossible(); setTokenValue(tok, std::move(value), settings); } else if (tok->variable() && tok->variable()->isArray() && !tok->variable()->isArgument() && - tok->variable()->getTypeName() != "std::array") {) { + tok->variable()->getTypeName() != "std::array") { ValueFlow::Value value{0}; value.setImpossible(); setTokenValue(tok, std::move(value), settings); From 5bec8eb6a833e39a3cc5393eff1d640cf8b0910d Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 29 Sep 2026 16:34:29 +0200 Subject: [PATCH 4/4] Update valueflow.cpp [skip ci] --- lib/valueflow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 4a465172dcf..7af430fdce3 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -727,7 +727,7 @@ static void valueFlowArrayBool(TokenList& tokenlist, const Settings& settings) } if (!var) continue; - if (!var->isArray() || var->isArgument() || var->isStlType()) + if (!var->isArray() || var->isArgument() || var->getTypeName() == "std::array") continue; if (isNonZero(getOtherOperand(tok)) && Token::Match(tok->astParent(), "%comp%")) continue;