I was a bit confused by the fact that the functions differ in presence/absence cv-qualifiers are equiavalent N4296::13.1/3.4 [over.load]:
Parameter declarations that differ only in the presence or absence of const and/or volatile are equivalent.
Example:
#include <iostream>
void foo(int){ }
void foo(const int){ } //error: redifinition
int main(){ }
Now, let me provide an example with member-functions.
#include <iostream>
struct A
{
A(){ }
void foo(){ std::cout << "foo()" << std::endl; }
void foo() const{ std::cout << "foo() const" << std::endl; }
};
A aa;
const A a;
int main(){ aa.foo(); a.foo(); }
N4296::13.3.1/2 [over.match.funcs]
member function is considered to have an extra parameter, called the implicit object parameter, which represents the object for which the member function has been called
So, the member function declarations are different only in presence of the const-qualifier, but they are still overloadable. Doesn't it contradict to the quote from N4296::13.1/3.4 [over.load] I provided before?
A*andconst A*is very different from the difference betweenintandconst int.