https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48101
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- Which causes the code to be accepted. I'd rather do: template<typename T> class allocator<const T>; // undefined so there's an error.