[libcxx-commits] [PATCH] D154613: [libc++] Fix std::move algorithm with trivial move-only types
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jul 10 07:07:33 PDT 2023
ldionne marked an inline comment as done.
ldionne added inline comments.
================
Comment at: libcxx/include/__string/constexpr_c_functions.h:171
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& __assign_trivially_copyable(_Tp& __dest, _Up const& __src) {
+ std::__construct_at(std::addressof(__dest), __src);
+ return __dest;
----------------
philnik wrote:
> Could you add a comment here explaining that we implicitly end the lifetime of the old object and then start the lifetime of the new object? I think this is a quite obscure part of the standard.
> A program is not required to call the destructor of an object to end its lifetime if the object is trivially-destructible (be careful that the correct behavior of the program may depend on the destructor).
>From https://en.cppreference.com/w/cpp/language/lifetime (under storage reuse). Comment added x2.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154613/new/
https://reviews.llvm.org/D154613
More information about the libcxx-commits
mailing list