Skip to content

Commit 54ca883

Browse files
committed
Add test for 14480
1 parent ffcbdfe commit 54ca883

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

test/testuninitvar.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ class TestUninitVar : public TestFixture {
9797
TEST_CASE(uninitvar_memberfunction);
9898
TEST_CASE(uninitvar_nonmember); // crash in ycmd test
9999
TEST_CASE(uninitvarDesignatedInitializers);
100+
TEST_CASE(uninitvarMemberPointer);
100101

101102
TEST_CASE(isVariableUsageDeref); // *p
102103
TEST_CASE(isVariableUsageDerefValueflow); // *p
@@ -7825,6 +7826,16 @@ class TestUninitVar : public TestFixture {
78257826
ASSERT_EQUALS("", errout_str());
78267827
}
78277828

7829+
void uninitvarMemberPointer() {
7830+
checkUninitVar("void f()\n"
7831+
"{\n"
7832+
" struct S {};\n"
7833+
" int S::* mp;\n"
7834+
" if (mp) {}\n"
7835+
"}\n");
7836+
ASSERT_EQUALS("[test.cpp:5:7]: (error) Uninitialized variable: mp [legacyUninitvar]\n", errout_str());
7837+
}
7838+
78287839
void isVariableUsageDeref() {
78297840
// *p
78307841
checkUninitVar("void f() {\n"

0 commit comments

Comments
 (0)