http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49118
--- Comment #4 from David Krauss <potswa at mac dot com> 2011-05-26 03:37:44 UTC --- Created attachment 24359 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24359 Patch fixes behavior but error message repeats twice. I implemented the suggested fix, but the resulting error message repeats the part about "template instantiation depth exceeds maximum" twice. The template backtrace appears after the error, not before as with a usual nesting problem. Is there something I'm obviously doing wrong here? Here are the most relevant lines from the attached patch. /* For diagnostic purposes, pretend that the chain is nested. */ if (CLASS_TYPE_P (chain_type) && CLASSTYPE_TEMPLATE_INFO (chain_type)) push_tinst_level (chain_type);