Consider the following code:
#include<utility>
struct S {
void f(int) = delete;
void f(int) && { }
};
int main() { }
It does not compile, saying that the member method cannot be overloaded, and that makes sense, of course.
On the other hand, the following code compiles:
#include<utility>
struct S {
void f(int) & = delete;
void f(int) && { }
};
int main() {
S s;
std::move(s).f(42);
}
Is this legal code?
Wouldn't it be possible to define two completely different interfaces in the same class, the first of which will be used with lvalues, the last with rvalues?
Except that it doesn't make much sense, but it really hurts me.
Should the function to be deleted be deleted as a whole, and not deleted only if you are an lvalue?
What is the purpose of this feature? Is this a classic obscure corner case, or is there something more I can't see?