diff --git a/lib/astutils.cpp b/lib/astutils.cpp index 4c7ad909834..f63d8b5b10c 100644 --- a/lib/astutils.cpp +++ b/lib/astutils.cpp @@ -3148,7 +3148,7 @@ static ExprUsage getFunctionUsage(const Token* tok, int indirect, const Settings } else if (ftok->isControlFlowKeyword()) { return ExprUsage::Used; } else if (ftok->str() == "{") { - return ExprUsage::Used; + return indirect == 0 ? ExprUsage::Used : ExprUsage::Inconclusive; } else { const bool isnullbad = settings->library.isnullargbad(ftok, argnr + 1); if (indirect == 0 && astIsPointer(tok) && !addressOf && isnullbad) diff --git a/test/testuninitvar.cpp b/test/testuninitvar.cpp index 9cc8b5030cb..c8b02fca49a 100644 --- a/test/testuninitvar.cpp +++ b/test/testuninitvar.cpp @@ -6197,6 +6197,12 @@ class TestUninitVar : public TestFixture { " x = i;\n" "}\n"); ASSERT_EQUALS("[test.cpp:3]: (error) Uninitialized variable: i\n", errout.str()); + + valueFlowUninit("void f() {\n" // #11890 + " int x;\n" + " int* a[] = { &x };\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); } void valueFlowUninitBreak() { // Do not show duplicate warnings about the same uninitialized value