Skip to content

Commit fe3bf91

Browse files
Add test for #12401 (#6289)
1 parent 26da798 commit fe3bf91

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/testuninitvar.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7502,6 +7502,16 @@ class TestUninitVar : public TestFixture {
75027502
" int len = strlen(arr);\n"
75037503
"}\n");
75047504
ASSERT_EQUALS("[test.cpp:8]: (error) Uninitialized variable: arr\n", errout_str());
7505+
7506+
valueFlowUninit("struct S1 { int x; };\n" // #12401
7507+
"struct S2 { struct S1 s1; };\n"
7508+
"struct S2 f() {\n"
7509+
" struct S2 s2;\n"
7510+
" struct S1* s1 = &s2.s1;\n"
7511+
" s1->x = 0;\n"
7512+
" return s2;\n"
7513+
"}\n");
7514+
ASSERT_EQUALS("", errout_str());
75057515
}
75067516

75077517
void uninitvar_memberfunction() {

0 commit comments

Comments
 (0)