[libcxx-commits] [libcxx] [libc++][hardening] Constrain construction for `__{bounded, wrap}_iter` (PR #115271)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Nov 7 06:36:02 PST 2024
================
@@ -67,7 +72,13 @@ struct __bounded_iter {
_LIBCPP_HIDE_FROM_ABI __bounded_iter(__bounded_iter const&) = default;
_LIBCPP_HIDE_FROM_ABI __bounded_iter(__bounded_iter&&) = default;
- template <class _OtherIterator, __enable_if_t< is_convertible<_OtherIterator, _Iterator>::value, int> = 0>
+ template < class _OtherIterator,
+ __enable_if_t<
+ _And<is_constructible<_Iterator, const _OtherIterator&>,
+ is_convertible<const _OtherIterator&, _Iterator>,
+ _Or<is_same<reference, __iter_reference<_OtherIterator> >,
+ is_same<reference, __make_const_lvalue_ref<__iter_reference<_OtherIterator> > > > >::value,
----------------
ldionne wrote:
The reference can't be a proxy type because this is required to be a contiguous iterator (and that implies `is_lvalue_reference<reference>`), correct?
https://github.com/llvm/llvm-project/pull/115271
More information about the libcxx-commits
mailing list