diff options
Diffstat (limited to 'libcxx/include/span')
-rw-r--r-- | libcxx/include/span | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libcxx/include/span b/libcxx/include/span index 00793a210cbe..67d2ac241ff2 100644 --- a/libcxx/include/span +++ b/libcxx/include/span @@ -453,9 +453,10 @@ public: : __data{_VSTD::to_address(__first)}, __size{__count} {} template <__span_compatible_iterator<element_type> _It, __span_compatible_sentinel_for<_It> _End> - _LIBCPP_INLINE_VISIBILITY - constexpr span(_It __first, _End __last) - : __data(_VSTD::to_address(__first)), __size(__last - __first) {} + _LIBCPP_INLINE_VISIBILITY constexpr span(_It __first, _End __last) + : __data(_VSTD::to_address(__first)), __size(__last - __first) { + _LIBCPP_ASSERT(__last - __first >= 0, "invalid range in span's constructor (iterator, sentinel)"); + } template <size_t _Sz> _LIBCPP_INLINE_VISIBILITY |