[libcxx-commits] [PATCH] D101638: [libc++] std::to_address mustn't depend on P::element_type.

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 5 11:39:54 PDT 2021


Quuxplusone added a comment.

Discussed offline and gave Louis a couple more test cases to merge in here.



================
Comment at: libcxx/include/__memory/pointer_traits.h:206-208
+auto to_address(_Pointer&& __p) noexcept {
+    return _VSTD::__to_address(_VSTD::forward<_Pointer>(__p));
 }
----------------
ldionne wrote:
> Does anybody see an issue with doing this? I don't think this is detectable, so we should be conforming?
Is "this" the perfect-forwarding? I think it's reasonably undetectable, but also unneeded. I just changed this back to
```
auto
to_address(const _Pointer& __p) _NOEXCEPT
{
    return _VSTD::__to_address(__p);
}
```
locally, and it still passed all of our new tests with flying colors. So I strongly recommend either changing it back, //or// (if I'm missing something) adding a test case that "explains" the purpose of the forwarding reference.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101638



More information about the libcxx-commits mailing list