Fix the ranking of reference bindings during overload resolution
commitbf602c5e5103f53ffd157a3868e0ef923f7b255b
authorDouglas Gregor <doug.gregor@gmail.com>
Tue, 25 Jan 2011 19:39:31 +0000 (25 19:39 +0000)
committerDouglas Gregor <doug.gregor@gmail.com>
Tue, 25 Jan 2011 19:39:31 +0000 (25 19:39 +0000)
treecf66a419edab829b4ca3e10c1e71ae03d1685655
parenta34bc2882ce5af40edc786bc2061a723603a7e33
Fix the ranking of reference bindings during overload resolution
(C++0x [over.ics.rank]p3) when one binding is an lvalue reference and
the other is an rvalue reference that binds to an rvalue. In
particular, we were using the predict "is an rvalue reference" rather
than "is an rvalue reference that binds to an rvalue", which was
incorrect in the one case where an rvalue reference can bind to an
lvalue: function references.

This particular issue cropped up with std::forward, where Clang was
picking an std::forward overload while forwarding an (lvalue)
reference to a function. However (and unfortunately!), the right
answer for this code is that the call to std::forward is
ambiguous. Clang now gets that right, but we need to revisit the
std::forward implementation in libc++.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124216 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaOverload.cpp
test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp