From 010ce12a82eaf0061a175cbac8c97d5ca97ef68f Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 6 Dec 2023 16:36:46 +0100 Subject: [PATCH] QSpan: don't truncate QSpan::extent My notes inform me that my intent was for QSpan::extent to be size_t, for compatibility with both its template argument and std::span::extent. So fix it to be size_t instead of qsizetype. While extents that go beyond numeric_limits::max() will be unusable in practice, QSpan doesn't actually allocate memory, so declaring one should be possible, if only for compatibility with std::span, without getting into a situation where E != extent. Change-Id: Ic8ae3a1c03801b4a23b7ba56388372cac64f9e5e Reviewed-by: Fabian Kosmale Reviewed-by: Thiago Macieira (cherry picked from commit d6969b76a5281d5dcadc6ef722594d6ba2effd68) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/tools/qspan_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qspan_p.h b/src/corelib/tools/qspan_p.h index 56e6886aed1..f9de3ee4119 100644 --- a/src/corelib/tools/qspan_p.h +++ b/src/corelib/tools/qspan_p.h @@ -283,7 +283,7 @@ public: using const_iterator = const_pointer; // implementation-defined choice using reverse_iterator = std::reverse_iterator; using const_reverse_iterator = std::reverse_iterator; - static constexpr size_type extent = E; + static constexpr std::size_t extent = E; // [span.cons], constructors, copy, and assignment using Base::Base;