https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98798
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Martin Liška from comment #2) > I think it's a bug in libstdc++ and one can see it with valgrind: But there's no error when compiled with clang and libstdc++, so that suggests the problem is g++ not libstdc++.