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

Method varid_in_class25

test/testvarid.cpp:2294–2331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2292 }
2293
2294 void varid_in_class25() {
2295 const Settings s = settingsBuilder(settings).library("std.cfg").build();
2296
2297 const char *expected{};
2298 {
2299 const char code[] = "struct F {\n" // #11497
2300 " int i;\n"
2301 " void f(const std::vector<F>&v) {\n"
2302 " if (v.front().i) {}\n"
2303 " }\n"
2304 "};\n";
2305 expected = "1: struct F {\n"
2306 "2: int i@1 ;\n"
2307 "3: void f ( const std :: vector < F > & v@2 ) {\n"
2308 "4: if ( v@2 . front ( ) . i@3 ) { }\n"
2309 "5: }\n"
2310 "6: } ;\n";
2311 ASSERT_EQUALS(expected, tokenize(code, s));
2312 }
2313
2314 {
2315 const char code[] = "struct T { };\n" // 11533
2316 "struct U { T t; };\n"
2317 "std::vector<U*>* g();\n"
2318 "void f() {\n"
2319 " std::vector<U*>* p = g();\n"
2320 " auto t = p->front()->t;\n"
2321 "}\n";
2322 expected = "1: struct T { } ;\n"
2323 "2: struct U { T t@1 ; } ;\n"
2324 "3: std :: vector < U * > * g ( ) ;\n"
2325 "4: void f ( ) {\n"
2326 "5: std :: vector < U * > * p@2 ; p@2 = g ( ) ;\n"
2327 "6: auto t@3 ; t@3 = p@2 . front ( ) . t@4 ;\n"
2328 "7: }\n";
2329 ASSERT_EQUALS(expected, tokenize(code, s));
2330 }
2331 }
2332
2333 void varid_in_class26() {
2334 const char *expected{}; // #11334

Callers

nothing calls this directly

Calls 2

buildMethod · 0.80
libraryMethod · 0.80

Tested by

no test coverage detected