https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87017
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- N.B. it only works with clang and ICC because you're using them with an older version of libstdc++, which didn't enforce this requirement. Saying "it compiles with three compilers all using the same standard library" is only one data point. If you use clang's own libc++ you get a similar error: In file included from /opt/wandbox/clang-head/include/c++/v1/regex:770: /opt/wandbox/clang-head/include/c++/v1/vector:486:5: error: static_assert failed due to requirement 'is_same<typename allocator_type::value_type, value_type>::value' "Allocator::value_type must be same type as value_type" static_assert((is_same<typename allocator_type::value_type, value_type>::value), ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /opt/wandbox/clang-head/include/c++/v1/regex:5228:23: note: in instantiation of template class 'std::__1::vector<std::__1::sub_match<std::__1::__wrap_iter<const char *> >, FaF::Allocator<std::__1::__wrap_iter<const char *> > >' requested here __container_type __matches_; ^ prog.cc:33:15: note: in instantiation of template class 'std::__1::match_results<std::__1::__wrap_iter<const char *>, FaF::Allocator<std::__1::__wrap_iter<const char *> > >' requested here FaF::smatch results {}; ^ That's because the code is not valid according to the standard.