https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97232
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- If you compile with -D_GLIBCXX_ASSERTIONS then there is a runtime check: /home/jwakely/gcc/11/include/c++/11.0.0/bits/stl_iterator_base_funcs.h:151: constexpr void std::__advance(_InputIterator&, _Distance, std::input_iterator_tag) [with _InputIterator = std::_Fwd_list_iterator<int>; _Distance = long int]: Assertion '__n >= 0' failed. Aborted (core dumped)