[libcxx-commits] [PATCH] D151223: [libc++] Fixes use-after move diagnostic.
Mark de Wever via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue May 30 08:23:11 PDT 2023
Mordante added inline comments.
================
Comment at: libcxx/include/strstream:261
: istream(_VSTD::move(__rhs)),
- __sb_(_VSTD::move(__rhs.__sb_))
+ __sb_(_VSTD::move(__rhs.__sb_)) // NOLINT(bugprone-use-after-move)
{
----------------
ldionne wrote:
> What is the non-standard extension? I don't understand why this code is valid and this isn't a bug? Does `istream(_VSTD::move(__rhs))` above not move the `__sb_` member? If not, would it be possible to instead do something like
>
> ```
> istream(std::move(static_cast<istream&>(__rhs)))
> ```
>
> to make it clear that we're only moving `__rhs` as a base class object (if that's what's going on)?
The non-Standard part are the move operations. I've updated the description of the patch.
I can make that change, it looks closer to my original edit `istream(static_cast<istream&&>(__rhs))`, but this is less subtle :-)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151223/new/
https://reviews.llvm.org/D151223
More information about the libcxx-commits
mailing list