http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16564
--- Comment #20 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- (In reply to Manuel López-Ibáñez from comment #19) > (In reply to Volker Reichelt from comment #18) > > The first error message about exceeding the maximum template instantiation > > depth appears rather quickly. So maybe we could make the first error message > > a fatal one to avoid further processing of potentially bogus nested classes. > > It seems to me GCC is doing something strange. See comment #14. But what you > suggest seems to be what Clang++ is doing: Although GCC is still much slower than Clang for Steven's original testcase, so the above wouldn't be a complete fix. And the long lines are very ugly. Perhaps there is a way to summarize such a recursive template instantiation. Still, making the "error: template instantiation depth exceeds maximum" a fatal error seems a good idea to me. Jason?