https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113841
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> --- Calling swap unqualified performs ADL, which has to find all the associated namespaces and associated classes. To do that it has to complete all the types involved, which means it tries to complete: std::hash<std::pair<const int, MyArrVec>*> std::pair<const int, MyArrVec> MyArrVec MyVec MyAllocator<int> Trying to complete MyVec hits an error outside the immediate context, because its default constructor cannot be instantiated, because MyAllocator<int> is not default constructible. That's why comment 5 fixes it.