parent
a666e31801
commit
d06f93aebf
|
@ -5470,10 +5470,14 @@ const Function* Scope::findFunction(const Token *tok, bool requireConst) const
|
||||||
if (fallback2Func)
|
if (fallback2Func)
|
||||||
return fallback2Func;
|
return fallback2Func;
|
||||||
|
|
||||||
// remove pure virtual function
|
// remove pure virtual function if there is an overrider
|
||||||
matches.erase(std::remove_if(matches.begin(), matches.end(), [](const Function* m) {
|
auto itPure = std::find_if(matches.begin(), matches.end(), [](const Function* m) {
|
||||||
return m->isPure();
|
return m->isPure();
|
||||||
}), matches.end());
|
});
|
||||||
|
if (itPure != matches.end() && std::any_of(matches.begin(), matches.end(), [&](const Function* m) {
|
||||||
|
return m->isImplicitlyVirtual() && m != *itPure;
|
||||||
|
}))
|
||||||
|
matches.erase(itPure);
|
||||||
|
|
||||||
// Only one candidate left
|
// Only one candidate left
|
||||||
if (matches.size() == 1)
|
if (matches.size() == 1)
|
||||||
|
|
|
@ -141,6 +141,7 @@ private:
|
||||||
TEST_CASE(nullpointer95); // #11142
|
TEST_CASE(nullpointer95); // #11142
|
||||||
TEST_CASE(nullpointer96); // #11416
|
TEST_CASE(nullpointer96); // #11416
|
||||||
TEST_CASE(nullpointer97); // #11229
|
TEST_CASE(nullpointer97); // #11229
|
||||||
|
TEST_CASE(nullpointer98); // #11458
|
||||||
TEST_CASE(nullpointer_addressOf); // address of
|
TEST_CASE(nullpointer_addressOf); // address of
|
||||||
TEST_CASE(nullpointerSwitch); // #2626
|
TEST_CASE(nullpointerSwitch); // #2626
|
||||||
TEST_CASE(nullpointer_cast); // #4692
|
TEST_CASE(nullpointer_cast); // #4692
|
||||||
|
@ -2796,6 +2797,17 @@ private:
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nullpointer98() // #11458
|
||||||
|
{
|
||||||
|
check("struct S { double* d() const; };\n"
|
||||||
|
"struct T {\n"
|
||||||
|
" virtual void g(double* b, double* d) const = 0;\n"
|
||||||
|
" void g(S* b) const { g(b->d(), nullptr); }\n"
|
||||||
|
" void g(S* b, S* d) const { g(b->d(), d->d()); }\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
void nullpointer_addressOf() { // address of
|
void nullpointer_addressOf() { // address of
|
||||||
check("void f() {\n"
|
check("void f() {\n"
|
||||||
" struct X *x = 0;\n"
|
" struct X *x = 0;\n"
|
||||||
|
|
Loading…
Reference in New Issue