https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86189
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |WAITING Last reconfirmed| |2018-06-18 Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Rian Quinn from comment #0) > template <typename T1, typename T2> > bool operator==(const myallocator4<T1> &, const myallocator4<T2> &) > { return false; } > > template <typename T1, typename T2> > bool operator!=(const myallocator4<T1> &, const myallocator4<T2> &) > { return true; } Your allocators *always* compare unequal to all other instances of the same allocator. This is invalid, a copy-constructed allocator must compare equal to the original, and be able to deallocate its memory. I haven't analysed any further, but I assume that the containers are using a copy to deallocate, which is perfectly fine. If you think the problem lies elsewhere please reopen this.