[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:03 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>,
----------------
ldionne wrote:

Do you need to check both `is_convertible` and `is_constructible`? Doesn't convertibility subsume constructibility?

https://github.com/llvm/llvm-project/pull/115271


More information about the libcxx-commits mailing list