[PATCH] D98971: [C++20] [P1825] Fix bugs with implicit-move from variables of reference type

Arthur O'Dwyer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 19 11:05:12 PDT 2021


Quuxplusone created this revision.
Quuxplusone added reviewers: rsmith, nullptr.cpp, aaronpuchert, mizvekov, erik.pilkington, sberg, davidstone, david_stone.
Quuxplusone added a project: clang.
Quuxplusone requested review of this revision.
Herald added a subscriber: cfe-commits.

Review D88220 <https://reviews.llvm.org/D88220> turns out to have some pretty severe bugs, but I *think* this patch fixes them.

Paper P1825 <https://reviews.llvm.org/P1825> is supposed to enable implicit move from "non-volatile objects
and rvalue references to non-volatile object types." Instead, what was committed
seems to have enabled implicit move from "non-volatile things of all kinds,
except that if they're rvalue references then they must also refer to non-volatile
things." In other words, D88220 <https://reviews.llvm.org/D88220> accidentally enabled implicit move from
lvalue object references (super yikes!) and also from non-object references
(such as references to functions).

These two cases are now fixed and regression-tested.

(For better and worse, D88220 <https://reviews.llvm.org/D88220> was present in trunk for more than a month before anyone noticed the (very major!) bug — my thanks to @sberg for reporting it! — so we may be able to take our time fixing it, but also it may be another month before someone spots the //next// bug. I have no strong opinion on the process here.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98971

Files:
  clang/lib/Sema/SemaStmt.cpp
  clang/test/CXX/class/class.init/class.copy.elision/p3.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98971.331938.patch
Type: text/x-patch
Size: 4798 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210319/b84f8d26/attachment.bin>


More information about the cfe-commits mailing list