I know that in the following situation that the compiler is free to move-construct the return value from makeA (but is also free to elide the copy or move altogether):
struct A
{
    A(A&);
    A(A&&);
};
A makeA()
{
    A localA;
    return localA;
}
What I wonder is whether the compiler is allowed to construct an object of type A from a local object of type B by rvalue reference if it is being constructed in the return statement. In other words, in the following example, is the compiler allowed to select A's constructor 4 for the return value?
struct B { };
struct A {
    A(A&);  // (1)
    A(A&&); // (2)
    A(B&);  // (3)
    A(B&&); // (4)
};
A makeA()
{
    B localB;
    return localB;
}
I ask this because it would seem to me that the same logic that allows a local object of type A to be treated as an rvalue in the return statement should also allow a local of any type to be treated as an rvalue, but I cannot find any examples or questions of this nature.
 
     
    