------- Comment #13 from manu at gcc dot gnu dot org 2010-04-13 23:48 ------- I have a patch that prints this: /home/manuel/src/pr9335.C:2:36: error: template instantiation depth exceeds maximum of 1024 (use -ftemplate-depth= to increase the maximum) instantiating ‘struct X<-0x00000000000000018>’ /home/manuel/src/pr9335.C:2:36: recursively instantiated from ‘const int X<1000>::value’ /home/manuel/src/pr9335.C:4:17: instantiated from here /home/manuel/src/pr9335.C:2:36: error: incomplete type ‘X<-0x00000000000000018>’ used in nested name specifier /home/manuel/src/pr9335.C: In instantiation of ‘const int X<-0x00000000000000016>::value’: /home/manuel/src/pr9335.C:2:36: recursively instantiated from ‘const int X<1000>::value’ /home/manuel/src/pr9335.C:4:17: instantiated from here /home/manuel/src/pr9335.C:2:36: error: ‘X<-0x00000000000000016>::value’ cannot be initialized by a non-constant expression when being declared /home/manuel/src/pr9335.C: In instantiation of ‘const int X<-0x00000000000000015>::value’: /home/manuel/src/pr9335.C:2:36: recursively instantiated from ‘const int X<1000>::value’ /home/manuel/src/pr9335.C:4:17: instantiated from here /home/manuel/src/pr9335.C:2:36: error: ‘X<-0x00000000000000015>::value’ cannot be initialized by a non-constant expression when being declared /home/manuel/src/pr9335.C: In instantiation of ‘const int X<-0x00000000000000014>::value’: /home/manuel/src/pr9335.C:2:36: recursively instantiated from ‘const int X<1000>::value’ /home/manuel/src/pr9335.C:4:17: instantiated from here then continues for 4000 lines It is perhaps an improvement but not a fix. @Jason, I see that in pt.c (instantiate_decl), after we get the first error, then init == error_mark_node. However, the parser continues building the declaration as if nothing. And we end up with something like: unit size align 32 symtab 0 alias set -1 canonical type 0x7ffff7490f18 precision 32 min max > readonly constant used public static tree_1 tree_2 tree_3 external nonlocal decl_3 decl_6 SI file /home/manuel/src/pr9335.C line 2 col 36 size unit size align 32 context initial template-info 0x7ffff7177600 chain > Couldn't we abort all this earlier? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9335