File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1501,6 +1501,10 @@ void CheckOther::checkConstPointer()
15011501 nonConstPointers.insert (tok->variable ());
15021502 }
15031503 for (const Variable *p: pointers) {
1504+ if (p->isArgument ()) {
1505+ if (!p->scope () || !p->scope ()->function || p->scope ()->function ->isImplicitlyVirtual (true ) || p->scope ()->function ->hasVirtualSpecifier ())
1506+ continue ;
1507+ }
15041508 if (nonConstPointers.find (p) == nonConstPointers.end ())
15051509 constVariableError (p, nullptr );
15061510 }
Original file line number Diff line number Diff line change @@ -2746,6 +2746,10 @@ class TestOther : public TestFixture {
27462746 " w = 1;\n "
27472747 " }" );
27482748 ASSERT_EQUALS (" " , errout.str ());
2749+
2750+ check (" class Base { virtual void dostuff(int *p) = 0; };\n " // #10397
2751+ " class Derived: public Base { int x; void dostuff(int *p) override { x = *p; } };" );
2752+ ASSERT_EQUALS (" " , errout.str ());
27492753 }
27502754
27512755 void switchRedundantAssignmentTest () {
You can’t perform that action at this time.
0 commit comments