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/3] 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/3] 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/3] 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);