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

Method uninitVarArray10

test/testconstructors.cpp:3293–3312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3291 }
3292
3293 void uninitVarArray10() { // #11650
3294 const Settings s = settingsBuilder(settings).library("std.cfg").build();
3295 check("struct T { int j; };\n"
3296 "struct U { int k{}; };\n"
3297 "struct S {\n"
3298 " std::array<int, 2> a;\n"
3299 " std::array<T, 2> b;\n"
3300 " std::array<std::size_t, 2> c;\n"
3301 " std::array<clock_t, 2> d;\n"
3302 " std::array<std::string, 2> e;\n"
3303 " std::array<U, 2> f;\n"
3304 "S() {}\n"
3305 "};\n", s);
3306
3307 ASSERT_EQUALS("[test.cpp:10:1]: (warning) Member variable 'S::a' is not initialized in the constructor. [uninitMemberVar]\n"
3308 "[test.cpp:10:1]: (warning) Member variable 'S::b' is not initialized in the constructor. [uninitMemberVar]\n"
3309 "[test.cpp:10:1]: (warning) Member variable 'S::c' is not initialized in the constructor. [uninitMemberVar]\n"
3310 "[test.cpp:10:1]: (warning) Member variable 'S::d' is not initialized in the constructor. [uninitMemberVar]\n",
3311 errout_str());
3312 }
3313
3314 void uninitVarArray11() {
3315 check("class C {\n" // #12150

Callers

nothing calls this directly

Calls 2

buildMethod · 0.80
libraryMethod · 0.80

Tested by

no test coverage detected