https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60976
--- Comment #36 from Giuseppe Ottaviano <ott at fb dot com> --- (In reply to Jonathan Wakely from comment #35) > I've backported the std::allocator_traits<std::allocator<T>> partial > specialization to the gcc-4.9 and gcc-5 branches now. Please let me know if > this makes any difference for your use cases (and provide testcases to > reproduce problems if not). I reported our relative build times with my version of the partial specialization a few comments above: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60976#c26 . Your partial specialization patch causes an ICE in our version of GCC 4.9: <include_dir>/bits/alloc_traits.h:464:56: internal compiler error: in retrieve_specialization, at cp/pt.c:1057 0x5615cf retrieve_specialization <src_dir>/gcc/cp/pt.c:1054 0x57809e tsubst_decl <src_dir>/gcc/cp/pt.c:11079 0x56a9b4 tsubst(tree_node*, tree_node*, int, tree_node*) <src_dir>/gcc/cp/pt.c:11559 0x570db4 instantiate_template_1 <src_dir>/gcc/cp/pt.c:15586 0x570db4 instantiate_template(tree_node*, tree_node*, int) <src_dir>/gcc/cp/pt.c:15636 0x56a918 instantiate_alias_template <src_dir>/gcc/cp/pt.c:15666 0x56a918 tsubst(tree_node*, tree_node*, int, tree_node*) <src_dir>/gcc/cp/pt.c:11586 0x56fef0 lookup_template_class_1 <src_dir>/gcc/cp/pt.c:7675 0x56fef0 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*, int, int) <src_dir>/gcc/cp/pt.c:7901 0x541e43 make_typename_type(tree_node*, tree_node*, tag_types, int) <src_dir>/gcc/cp/decl.c:3459 0x56b49a tsubst(tree_node*, tree_node*, int, tree_node*) <src_dir>/gcc/cp/pt.c:12189 0x577ec1 tsubst_decl <src_dir>/gcc/cp/pt.c:11110 0x56a9b4 tsubst(tree_node*, tree_node*, int, tree_node*) <src_dir>/gcc/cp/pt.c:11559 0x566fd6 tsubst_expr <src_dir>/gcc/cp/pt.c:13509 0x566dbc tsubst_expr <src_dir>/gcc/cp/pt.c:13452 0x56705f tsubst_expr <src_dir>/gcc/cp/pt.c:13657 0x566dbc tsubst_expr <src_dir>/gcc/cp/pt.c:13452 0x56705f tsubst_expr <src_dir>/gcc/cp/pt.c:13657 0x57a7a4 instantiate_decl(tree_node*, int, bool) <src_dir>/gcc/cp/pt.c:19980 0x57ee0b instantiate_pending_templates(int) <src_dir>/gcc/cp/pt.c:20096 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. Changing the definitions of rebind_alloc and rebind_traits to the following: template<typename _Tp1> using rebind_alloc = typename allocator_type::template rebind<_Tp1>::other; template<typename _Tp1> using rebind_traits = allocator_traits<rebind_alloc<_Tp1>>; fixes the ICE and matches the build time of my patch.