[libcxx-commits] [PATCH] D99873: [libcxx] adds `std::ranges::iter_move` and `std::iter_rvalue_reference_t`

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Apr 19 07:31:27 PDT 2021


ldionne marked 8 inline comments as done.
ldionne added inline comments.


================
Comment at: libcxx/include/__iterator/iter_move.h:59
+  constexpr decltype(auto) operator()(_Ip&& __i) const
+    noexcept(noexcept(*_VSTD::forward<_Ip>(__i)))
+  {
----------------
cjdb wrote:
> Quuxplusone wrote:
> > cjdb wrote:
> > > This noexcept specifier doesn't account for a throwing move.
> > "`move` doesn't move," and this function returns `decltype(auto)`, so I think we're okay here. This function either returns an rvalue reference in the `if`, or URVOs a prvalue in the `else`.
> @rsmith is the one who pointed it out to me, so I'm not so sure. Granted, the tests cover seem to be passing, but a looking over them again makes me realise I only tested noexcept specifiers in one direction. We'll need to plug those holes at the very least.
> This function either returns an rvalue reference in the if, or URVOs a prvalue in the else.

That was my reasoning when writing that.

> but a looking over them again makes me realise I only tested noexcept specifiers in one direction. We'll need to plug those holes at the very least.

Sorry, I'm not quite following, what do you mean by testing `noexcept` specifiers only in one direction? I'll add the test coverage, but I'd like to understand what's missing.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99873



More information about the libcxx-commits mailing list