From 17e8443ee66db66630f230cc7694d009241426cf Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Wed, 22 Jul 2026 16:16:34 +0200 Subject: [PATCH 1/2] Update vf_settokenvalue.cpp --- lib/vf_settokenvalue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vf_settokenvalue.cpp b/lib/vf_settokenvalue.cpp index 315f4a40129..aab64170890 100644 --- a/lib/vf_settokenvalue.cpp +++ b/lib/vf_settokenvalue.cpp @@ -384,7 +384,7 @@ namespace ValueFlow setTokenValueCast(parent, valueType, std::move(value), settings); } - else if (parent->str() == ":") { + else if (parent->str() == ":" && Token::simpleMatch(parent->astParent(), "?")) { setTokenValue(parent,std::move(value),settings); } From f2758670bd1f271d78113a54515a951f7c7d8db5 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Wed, 22 Jul 2026 16:18:51 +0200 Subject: [PATCH 2/2] Update testother.cpp --- test/testother.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/testother.cpp b/test/testother.cpp index 92fefb72fd3..c2367ed04b0 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -12903,6 +12903,13 @@ class TestOther : public TestFixture { " cif::condition mWhere;\n" "};\n"); ASSERT_EQUALS("", errout_str()); + + check("void g(std::string);\n" // #14928 + "void f(std::string s) {\n" + " g(std::move(s));\n" + " for (char c : s) {}\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:4:19]: (warning) Access of moved variable 's'. [accessMoved]\n", errout_str()); } void moveTernary()