https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89758
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- Your code has undefined behaviour, it's your responsibility to ensure you don't try to pop from an empty queue. Compiling with -D_GLIBCXX_DEBUG will show the problem: queue /usr/include/c++/8/bits/stl_queue.h:286: void std::queue<_Tp, _Sequence>::pop() [with _Tp = int; _Sequence = std::__debug::deque<int, std::allocator<int> >]: Assertion '__builtin_expect(!this->empty(), true)' failed. Aborted (core dumped)