MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / uninitvar_memberfunction

Method uninitvar_memberfunction

test/testuninitvar.cpp:7854–7874  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7852 }
7853
7854 void uninitvar_memberfunction() {
7855 // # 8715
7856 valueFlowUninit("struct C {\n"
7857 " int x();\n"
7858 "};\n"
7859 "void f() {\n"
7860 " C *c;\n"
7861 " if (c->x() == 4) {}\n"
7862 "}");
7863 ASSERT_EQUALS("[test.cpp:6:9]: (error) Uninitialized variable: c [uninitvar]\n", errout_str());
7864
7865 valueFlowUninit("struct A { \n"
7866 " int i; \n"
7867 " void f();\n"
7868 "};\n"
7869 "void g() {\n"
7870 " A a;\n"
7871 " a.f();\n"
7872 "}\n");
7873 ASSERT_EQUALS("", errout_str());
7874 }
7875
7876 void uninitvar_nonmember() {
7877 valueFlowUninit("struct Foo {\n"

Callers

nothing calls this directly

Calls 1

valueFlowUninitFunction · 0.85

Tested by

no test coverage detected