https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112314
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- Created attachment 56494 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56494&action=edit Check [ptr,end) and [ptr,ptr+n) ranges with _GLIBCXX_ASSERTIONS With this change we could add: __glibcxx_requires_string_len(__str, __len); to the string_view constructor. We could include checks for __len == 0 || __str != nullptr and PTRDIFF_MAX too.