rvalues with copy operator : <p>Consider this simple class</p>

<pre><code>class Foo
{
    public:
    Foo() = default;
    Foo(const Foo &amp;) = default;
    Foo &amp; operator=(const Foo &amp; rhs)
    {
        return *this;
    }
    Foo &amp; operator=(Foo &amp;&amp; rhs) = delete; 
};

Foo getFoo()
{
    Foo f;
    return f;
}

int main()
{
    Foo f;
    Foo &amp; rf = f;
    rf = getFoo();    // Use of deleted move assignment.
    return 0;   
}
</code></pre>

<p>When I compile the example above I get <code>error: use of deleted function 'Foo&amp; Foo::operator=(Foo&amp;&amp;)'</code></p>

<p>From the <a href="http://en.cppreference.com/w/cpp/language/copy_assignment">Copy Assignment</a>:</p>

<blockquote>
  <p>If only the copy assignment is provided, all argument categories select it (as long as it takes its argument by value or as reference to const, since rvalues can bind to const references), which makes copy assignment the fallback for move assignment, when move is unavailable.</p>
</blockquote>

<p>Why doesn't the compiler fallback to copy assignment when const lvalue reference can bind to rvalue and <code>const Foo &amp; f = getFoo();</code> works.</p>

<p>Compiler - gcc 4.7.2.</p>
