Consider this code:
struct A
{
void foo() const
{
std::cout << \"const\" << std::endl;
}
private:
void foo()
It's important to keep in mind the order of things that happen, which is:
deleted), fail. (3) happens after (2). Which is really important, because otherwise making functions deleted or private would become sort of meaningless and much harder to reason about.
In this case:
A::foo() and A::foo() const.A::foo() because the latter involves a qualification conversion on the implicit this argument.A::foo() is private and you don't have access to it, hence the code is ill-formed.