https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120997
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
Last reconfirmed| |2025-07-08
Target Milestone|--- |15.2
Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This fixes it:
--- a/libstdc++-v3/include/std/span
+++ b/libstdc++-v3/include/std/span
@@ -454,7 +454,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__glibcxx_assert(__count <= size());
__glibcxx_assert(__offset + __count <= size());
}
- return {this->data() + __offset, __count};
+ return span<element_type>(this->data() + __offset, __count);
}
private:
But we need the same fix in span::first and span::last, and maybe elsewhere.
That's needed because of this new constructor in C++26 mode:
#if __cpp_lib_span_initializer_list >= 202311L // >= C++26
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Winit-list-lifetime"
constexpr
explicit(extent != dynamic_extent)
span(initializer_list<value_type> __il)
requires (is_const_v<_Type>)
: _M_ptr(__il.begin()), _M_extent(__il.size())
{ }
#pragma GCC diagnostic pop
#endif
I haven't figured out yet whether G++ is correct to try to use that constructor
here.