[PATCH] D83902: [ADT] Add a range-based version of std::move

Endre Fülöp via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 21 07:59:32 PDT 2020


gamesh411 added a comment.

To further investigate the moving story, I also created a small example on Godbolt:
https://godbolt.org/z/5qMf1o

Note that the example linked works as expected even though perfect forwarding is employed everywhere. This is because the begin and is implemented by taking const reference.
One interesting thing to see if you would take `A` instances by value in begin and end functions, a move would occur and the use-after-move would be demonstrated.
Now, I don't think this is a very likely case, still, this is the best I could come up with, that is hypothetically dangerous.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83902





More information about the llvm-commits mailing list