From 73b4547186fab394cf68db8899280537303e7b1c Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 9 Apr 2024 11:37:14 +0200 Subject: [PATCH 1/2] Update astutils.cpp --- lib/astutils.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/astutils.cpp b/lib/astutils.cpp index 96ba644f3d5..7bf42b5a493 100644 --- a/lib/astutils.cpp +++ b/lib/astutils.cpp @@ -3305,6 +3305,7 @@ static ExprUsage getFunctionUsage(const Token* tok, int indirect, const Settings return ExprUsage::PassedByReference; } } + return ExprUsage::NotUsed; } } if (!args.empty() && indirect == 0 && !addressOf) From b5de1ab836ecc7a3517c8831bcba2e1c11b5d3c1 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 9 Apr 2024 11:38:00 +0200 Subject: [PATCH 2/2] Update testuninitvar.cpp --- test/testuninitvar.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/testuninitvar.cpp b/test/testuninitvar.cpp index 215b5167428..3ce6c654036 100644 --- a/test/testuninitvar.cpp +++ b/test/testuninitvar.cpp @@ -4345,6 +4345,13 @@ class TestUninitVar : public TestFixture { " a = item.a;\n" "}", "test.c"); ASSERT_EQUALS("", errout_str()); + + valueFlowUninit("void f(int& r) {}\n" // #12536 + "void g() {\n" + " int i;\n" + " f(i);\n" + "}"); + ASSERT_EQUALS("", errout_str()); } void uninitStructMember() { // struct members