]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Silence warning in mdspan.
authorLuc Grosheintz <luc.grosheintz@gmail.com>
Mon, 8 Dec 2025 20:23:40 +0000 (21:23 +0100)
committerTomasz Kamiński <tkaminsk@redhat.com>
Tue, 9 Dec 2025 12:26:08 +0000 (13:26 +0100)
Splitting the tests for submdspan triggered a compiler warning. This
commit changes the implementation of __dynamic_extents. In particular,
how the span is created. Functionally, the two are equivalent.

libstdc++-v3/ChangeLog:

* include/std/mdspan (_ExtentsStorage::_M_dynamic_extents):
Create span from pointer + size, not begin and end iterators.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
libstdc++-v3/include/std/mdspan

index 981fa1c601a1752cd35f655a3e6220b80e41838d..f0f6630b4729a0506bfe0009d44de2dafe04bd95 100644 (file)
@@ -271,7 +271,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        requires (_Extents.size() > 0)
        {
          return {_M_dyn_exts + _S_dynamic_index(__begin),
-                 _M_dyn_exts + _S_dynamic_index(__end)};
+                 _S_dynamic_index(__end) - _S_dynamic_index(__begin)};
        }
 
       private: