[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 08:10:07 PDT 2021
Quuxplusone created this revision.
Quuxplusone added reviewers: ldionne, zoecarver, libc++.
Quuxplusone added a project: libc++.
Quuxplusone requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added 1 blocking reviewer(s): libc++.
This came out of @zoecarver's observation on D101404 <https://reviews.llvm.org/D101404> that `std::to_address` wasn't working correctly with a type such as `vector<int>::iterator` whose `element_type` was being deduced wrongly. `std::to_address` actually shouldn't care about `element_type` at all.
Also, make sure it simulates an `auto` return type correctly: even if `pointer_traits<P>::to_address(p)` returns `int const* const&`, we should return the decayed type `int const*`.
Also, simplify the code a tiny bit.
This might actually make D101404 <https://reviews.llvm.org/D101404> obsolete; I haven't checked yet.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D101638
Files:
libcxx/include/__memory/pointer_traits.h
libcxx/test/std/utilities/memory/pointer.conversion/to_address.pass.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101638.341913.patch
Type: text/x-patch
Size: 6083 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210430/f8a2b935/attachment.bin>
More information about the libcxx-commits
mailing list