https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67707
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- Ugh, I hate allocators. I probably should have added a completely new std::__cxx11::deque for gcc-5 with nothrow move and full allocator support, instead of trying to bolt it on to our existing std::deque. Testing this fix: --- a/libstdc++-v3/include/bits/stl_deque.h +++ b/libstdc++-v3/include/bits/stl_deque.h @@ -644,6 +644,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _Tp_alloc_type __sink __attribute((__unused__)) {std::move(__alloc)}; // Create an empty map that allocates using the moved-from allocator. _Deque_base __empty{__alloc}; + __empty._M_initialize_map(0); // Now safe to modify current allocator and perform non-throwing swaps. _Deque_impl __ret{std::move(_M_get_Tp_allocator())}; _M_impl._M_swap_data(__ret);