I just don’t get it. Tried on VC++ 2008 and G++ 4.3.2
#include <map> class A : public std::multimap<int, bool> { public: size_type erase(int k, bool v) { return erase(k); // <- this fails; had to change to __super::erase(k) } }; int main() { A a; a.erase(0, false); a.erase(0); // <- fails. can't find base class' function?! return 0; }
When you declare a function in a class with the same name but different signature from a superclass, then the name resolution rules state that the compiler should stop looking for the function you are trying to call once it finds the first match. After finding the function by name, then it applies the overload resolution rules.
So what is happening is the compiler finds your implementation of
erase(int, bool)when you callerase(0), and then decides that the arguments don’t match.