Skip to content

Commit e71c3a8

Browse files
Update testvalueflow.cpp
1 parent 1fe3d95 commit e71c3a8

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

test/testvalueflow.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3188,6 +3188,18 @@ class TestValueFlow : public TestFixture {
31883188
" return x;\n"
31893189
"}\n";
31903190
ASSERT_EQUALS(true, testValueOfXKnown(code, 3U, -1));
3191+
3192+
code = "A* f() {\n" // #14864
3193+
" A* x{};\n"
3194+
" return x;\n"
3195+
"}\n";
3196+
ASSERT_EQUALS(true, testValueOfXKnown(code, 3U, 0));
3197+
3198+
code = "A* f() {\n"
3199+
" A* x{ nullptr };\n"
3200+
" return x;\n"
3201+
"}\n";
3202+
ASSERT_EQUALS(true, testValueOfXKnown(code, 3U, 0));
31913203
}
31923204

31933205
void valueFlowAfterSwap()

0 commit comments

Comments
 (0)