File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1332,7 +1332,7 @@ void CheckOther::checkPassByReference()
13321332 }
13331333
13341334 // Check if variable could be const
1335- if (!var->scope () || var->scope ()->function ->hasVirtualSpecifier ())
1335+ if (!var->scope () || var->scope ()->function ->isImplicitlyVirtual ())
13361336 continue ;
13371337
13381338 if (canBeConst (var, mSettings )) {
Original file line number Diff line number Diff line change @@ -1970,6 +1970,15 @@ class TestOther : public TestFixture {
19701970 " int* f(U u) { return u.b; }\n " );
19711971 ASSERT_EQUALS (" " , errout.str ());
19721972
1973+ check (" struct B { virtual int f(std::string s) = 0; };\n " // #11432
1974+ " struct D1 : B {\n "
1975+ " int f(std::string s) override { s += 'a'; return s.size(); }\n "
1976+ " }\n "
1977+ " struct D2 : B {\n "
1978+ " int f(std::string s) override { return s.size(); }\n "
1979+ " }\n " );
1980+ ASSERT_EQUALS (" " , errout.str ());
1981+
19731982 Settings settings1;
19741983 settings1.platform (Settings::Win64);
19751984 check (" using ui64 = unsigned __int64;\n "
You can’t perform that action at this time.
0 commit comments