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) 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