Fixed #10397 (FP constParameter - implementing an interface)
This commit is contained in:
parent
c2305b1da7
commit
e95395e5f0
|
@ -1501,6 +1501,10 @@ void CheckOther::checkConstPointer()
|
|||
nonConstPointers.insert(tok->variable());
|
||||
}
|
||||
for (const Variable *p: pointers) {
|
||||
if (p->isArgument()) {
|
||||
if (!p->scope() || !p->scope()->function || p->scope()->function->isImplicitlyVirtual(true) || p->scope()->function->hasVirtualSpecifier())
|
||||
continue;
|
||||
}
|
||||
if (nonConstPointers.find(p) == nonConstPointers.end())
|
||||
constVariableError(p, nullptr);
|
||||
}
|
||||
|
|
|
@ -2746,6 +2746,10 @@ private:
|
|||
" w = 1;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("class Base { virtual void dostuff(int *p) = 0; };\n" // #10397
|
||||
"class Derived: public Base { int x; void dostuff(int *p) override { x = *p; } };");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void switchRedundantAssignmentTest() {
|
||||
|
|
Loading…
Reference in New Issue