[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
Fri Apr 30 11:32:30 PDT 2021
Quuxplusone added inline comments.
================
Comment at: libcxx/include/__memory/pointer_traits.h:178
+struct __to_address_helper {
template <class _Pointer>
+ using __return_type = typename decay<
----------------
zoecarver wrote:
> (Non-blocking) Could we get rid of `__return_type` and just make this `auto` everywhere? We'd have to change `__choose_to_address` to something like `_IsValidExpansion<decltype(pointer_traits<_Pointer>::to_address(declval<const _Pointer&>()))>`. I don't know if that would work but wdyt?
I tried a bunch of simplifications locally and everything I tried eventually ran into //some// template-metaprogramming issue. Patches welcome (but test your idea locally because I bet it won't work for some obscure reason).
================
Comment at: libcxx/test/std/utilities/memory/pointer.conversion/to_address.pass.cpp:58
+struct P5 {
+ using element_type = Irrelevant;
+ int const* const& operator->() const;
----------------
zoecarver wrote:
> Not sure if this is substantially different, what about a test where `element_type = int*`?
The point of `P5`/`P6` is just to test that `auto to_address` in fact returns a decayed type (distinguishing from `decltype(auto) to_address` which is effectively what we had before this patch). `P5` tests the `operator->` case; `P6` tests the `pointer_traits::to_address` case.
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