[libcxx-commits] [PATCH] D102135: [libcxx][ranges] adds _`copyable-box`_
Tim Song via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jul 2 08:19:55 PDT 2021
tcanens added inline comments.
================
Comment at: libcxx/include/__ranges/copyable_box.h:130-131
+ // Implementation of assignment operators in case we perform optimization (1)
+ constexpr __copyable_box& operator=(__copyable_box const&) requires copyable<_Tp> = default;
+ constexpr __copyable_box& operator=(__copyable_box&&) requires movable<_Tp> = default;
+
----------------
Quuxplusone wrote:
> tcanens wrote:
> > The `constexpr` should be removed - on defaulted functions, an explicit `constexpr` is an assertion of constexpr-ness.
> That is true for defaulted //comparison and relational// operators in C++20; it's never been true for defaulted special member functions. (And yes this is horrible and I'm pretty sure a defect report has been filed somewhere.)
> https://godbolt.org/z/61e564vra
>
> So this code is technically correct as written. But stylistically I agree: writing `constexpr` here is redundant and should be removed.
> That is true for defaulted //comparison and relational// operators in C++20; it's never been true for defaulted special member functions. (And yes this is horrible and I'm pretty sure a defect report has been filed somewhere.)
> https://godbolt.org/z/61e564vra
That's not what https://timsong-cpp.github.io/cppwp/dcl.fct.def.default#3.sentence-1 says.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102135/new/
https://reviews.llvm.org/D102135
More information about the libcxx-commits
mailing list