https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66153
--- Comment #3 from Peter Boyle <paboyle at ph dot ed.ac.uk> --- http://stackoverflow.com/questions/30411079/counting-template-recursion-nest-depth Appears to affect all versions of g++ with various errors. Used: http://melpon.org/wandbox/permlink/eK2AVfZXXss0ZDu6 All versions of clang after 3.1 accept the code. Disambiguating "function(Container)" from function<enable_if...> manually by renaming function(Container) to ffunction(Container) makes it operate in the same way as ICPC and Clang. However, this should not have been necessary because substitution failure should have caused it to select the right "function" in every case At least, I believe it should work as original, clang believes and icpc believes, but g++ does not.