[libcxx-commits] [PATCH] D95983: [libc++] Essentially revert D94807, to avoid calling __unwrap_iter in constexpr contexts.
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Feb 3 15:35:05 PST 2021
Quuxplusone created this revision.
Quuxplusone added reviewers: rnk, ldionne, mclow.lists, EricWF.
Quuxplusone added a project: libc++.
Herald added a subscriber: mgrang.
Quuxplusone requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
The user might write a contiguous iterator where `std::to_address(it)` is not constant-evaluable. Add regression tests for this.
See the new comments in <algorithm>:
+// Furthermore, we can't do this for user-defined iterators because their
+// `to_address` may be non-constexpr and/or have observable side effects.
+// Furthermore, some algorithms (e.g. std::copy, but not std::sort) need
+// to convert the "unwrapped" pointer back into an iterator, for which there
+// is no standard API: we rely on implicit conversion to do the right thing.
+// For user-defined iterators this isn't a conforming assumption.
+// So the only type we actually unwrap is our own __wrap_iter<T*>.
This is horrible, in that it rolls back the "support for user-defined contiguous iterators" I promised in D94807 <https://reviews.llvm.org/D94807>. However, at this point I don't see how to make that work at all. :(
rG LLVM Github Monorepo
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 7173 bytes
Desc: not available
More information about the libcxx-commits