This patch removes the two-stage overload resolution when performing
implicit move, whereby the compiler does two separate overload resolutions:
one treating the operand as an rvalue, and then (if that resolution fails)
another one treating the operand as an lvalue. In the standard this was
introduced via CWG 1579 and implemented in gcc in r251035. In r11-2412,
we disabled the fallback OR in C++20 (but not in C++17). Then C++23 P2266
removed the fallback overload resolution, and changed the implicit move rules
once again. So we wound up with three different behaviors.
The two overload resolutions approach was complicated and quirky, so
users should transition to the newer model. Removing the maybe-rvalue
OR also allows us to simplify our code, for instance, now we can get
rid of LOOKUP_PREFER_RVALUE altogether.
This change means that code that previously didn't compile in C++17 will
now compile, for example:
struct S1 { S1(S1 &&); };
struct S2 : S1 {};
S1
f (S2 s)
{
return s; // OK, derived-to-base, use S1::S1(S1&&)
}
And conversely, code that used to work in C++17 may not compile anymore:
struct W {
W();
};
struct F {
F(W&);
F(W&&) = delete;
};
F fn ()
{
W w;
return w; // use w as rvalue -> use of deleted function F::F(W&&)
}