https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87544
--- Comment #2 from Gael Guennebaud <gael.guennebaud at gmail dot com> --- Indeed, if I redefine max_size as follows instead of relying on std::allocator then the warning is gone: size_type max_size() const { return std::numeric_limits<std::ptrdiff_t>::max()/sizeof(T); }