From ff081542aeb0ccf693703a9f60c57c0d49ea440d Mon Sep 17 00:00:00 2001 From: chrchr Date: Fri, 11 Aug 2023 16:05:17 +0200 Subject: [PATCH] Add test for #11731 --- test/testuninitvar.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/testuninitvar.cpp b/test/testuninitvar.cpp index 40962370175..fdaad7eb147 100644 --- a/test/testuninitvar.cpp +++ b/test/testuninitvar.cpp @@ -6160,6 +6160,15 @@ class TestUninitVar : public TestFixture { " init(s2.s1.a);\n" "}\n"); ASSERT_EQUALS("", errout.str()); + + valueFlowUninit("struct S { int i; };\n" // #11731 + "void f(const S*& p);\n" + "int g() {\n" + " const S* s;\n" + " f(s);\n" + " return s->i;\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); } void valueFlowUninitBreak() { // Do not show duplicate warnings about the same uninitialized value