[PATCH] D51741: [coro]Pass rvalue reference for named local variable to return_value

Arthur O'Dwyer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 9 12:23:40 PDT 2019


Quuxplusone added a comment.

In D51741#1701757 <https://reviews.llvm.org/D51741#1701757>, @aaronpuchert wrote:

> This change breaks the following code that worked before:
>
>   task<MoveOnly&> f(MoveOnly &value) {
>     co_return value;
>   }
>


This patch is heavily heavily merge-conflicted by P1825 <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1825r0.html>.

Aaron's example code should not be affected by P1825 <https://reviews.llvm.org/P1825>. It should do overload resolution on `task<MoveOnly&>::return_value` with one parameter of type `MoveOnly&`.

However,

  task<MoveOnly&> g(MoveOnly &&value) {
    co_return value;
  }
  task<MoveOnly&> h(MoveOnly value) {
    co_return value;
  }

Both of these should first do overload resolution for one parameter of type `MoveOnly&&`, and then, only if that overload resolution fails, should they fall back to overload resolution for one parameter of type `MoveOnly&`.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D51741/new/

https://reviews.llvm.org/D51741





More information about the llvm-commits mailing list