https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98421
Bug ID: 98421
Summary: std::span does not detect invalid range in Debug Mode
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
#define _GLIBCXX_DEBUG 1
#include <vector>
#include <span>
int main()
{
std::vector<int> coll;
coll.reserve(10);
std::span first3{coll.begin(), 3}; // or coll.data(), 3
}
This should abort, because coll.begin()+3 is undefined, violating the
precondition of the std::span constructor.