]> gcc.gnu.org Git - gcc.git/commitdiff
libstdc++: Only define std::span::at for C++26 [PR115335]
authorJonathan Wakely <jwakely@redhat.com>
Tue, 4 Jun 2024 14:06:44 +0000 (15:06 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 4 Jun 2024 14:26:27 +0000 (15:26 +0100)
In r14-5689-g1fa85dcf656e2f I added std::span::at and made the correct
changes to the __cpp_lib_span macro (with tests for the correct value in
C++20/23/26). But I didn't make the declaration of std::span::at
actually depend on the macro, so it was defined for C++20 and C++23, not
only for C++26. This fixes that oversight.

libstdc++-v3/ChangeLog:

PR libstdc++/115335
* include/std/span (span::at): Guard with feature test macro.

libstdc++-v3/include/std/span

index 43e9cf82a546764d2c71517331137b2218955fad..00fc527915261a69e105b4701d8ef81768b6b345 100644 (file)
@@ -287,6 +287,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        return *(this->_M_ptr + __idx);
       }
 
+#if __cpp_lib_span >= 202311L // >= C++26
       [[nodiscard]]
       constexpr reference
       at(size_type __idx) const
@@ -296,6 +297,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
                                       "of size %zu"), __idx, this->size());
        return *(this->_M_ptr + __idx);
       }
+#endif
 
       [[nodiscard]]
       constexpr pointer
This page took 0.086079 seconds and 5 git commands to generate.