You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
checkUselessOverride("struct B { virtual int f() { return 5; } };\n"// #11757
8364
+
"struct D : B {\n"
8365
+
" int f() override { return B::f(); }\n"
8366
+
"};");
8367
+
ASSERT_EQUALS("[test.cpp:1] -> [test.cpp:3]: (style) The function 'f' overrides a function in a base class but just delegates back to the base class.\n", errout.str());
8368
+
8369
+
checkUselessOverride("struct B { virtual void f(); };\n"
8370
+
"struct D : B {\n"
8371
+
" void f() override { B::f(); }\n"
8372
+
"};");
8373
+
ASSERT_EQUALS("[test.cpp:1] -> [test.cpp:3]: (style) The function 'f' overrides a function in a base class but just delegates back to the base class.\n", errout.str());
8374
+
8375
+
checkUselessOverride("struct B { virtual int f() = 0; };\n"
8376
+
"int B::f() { return 5; }\n"
8377
+
"struct D : B {\n"
8378
+
" int f() override { return B::f(); }\n"
8379
+
"};");
8380
+
ASSERT_EQUALS("", errout.str());
8381
+
8382
+
checkUselessOverride("struct B { virtual int f(int i); };\n"
8383
+
"struct D : B {\n"
8384
+
" int f(int i) override { return B::f(i); }\n"
8385
+
"};");
8386
+
ASSERT_EQUALS("[test.cpp:1] -> [test.cpp:3]: (style) The function 'f' overrides a function in a base class but just delegates back to the base class.\n", errout.str());
8387
+
8388
+
checkUselessOverride("struct B { virtual int f(int i); };\n"
0 commit comments