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

Method operatorEqSTL

test/testconstructors.cpp:2125–2148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2123 }
2124
2125 void operatorEqSTL() {
2126 check("class Fred\n"
2127 "{\n"
2128 "private:\n"
2129 " std::vector<int> ints;\n"
2130 "public:\n"
2131 " Fred();\n"
2132 " void operator=(const Fred &f);\n"
2133 "};\n"
2134 "\n"
2135 "Fred::Fred()\n"
2136 "{ }\n"
2137 "\n"
2138 "void Fred::operator=(const Fred &f)\n"
2139 "{ }", dinit(CheckOptions, $.inconclusive = true));
2140 ASSERT_EQUALS("[test.cpp:13:12]: (warning, inconclusive) Member variable 'Fred::ints' is not assigned a value in 'Fred::operator='. [operatorEqVarError]\n", errout_str());
2141
2142 const Settings s = settingsBuilder().certainty(Certainty::inconclusive).severity(Severity::style).severity(Severity::warning).library("std.cfg").build();
2143 check("struct S {\n"
2144 " S& operator=(const S& s) { return *this; }\n"
2145 " std::mutex m;\n"
2146 "};\n", s);
2147 ASSERT_EQUALS("", errout_str());
2148 }
2149
2150 void uninitVar1() {
2151 check("enum ECODES\n"

Callers

nothing calls this directly

Calls 2

buildMethod · 0.80
libraryMethod · 0.80

Tested by

no test coverage detected