https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43113
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> --- For the original case in comment #0 we get in GCC 5+: <source>: In instantiation of 'struct A<A<A<A<A<B>::S>::S>::S>::S>': <source>:5:11: recursively required from 'struct A<A<B>::S>' <source>:5:11: required from 'struct A<B>' <source>:8:12: required from here <source>:5:11: fatal error: template instantiation depth exceeds maximum of 5 (use -ftemplate-depth= to increase the maximum) A < S > ht; ^