When compiling foo.C using the command line g++ -ftemplate-depth-20000 foo.C
the result is g++: Internal error: Segmentation fault (program cc1plus) Please submit a full bug report. See <URL:http://gcc.gnu.org/bugs.html> for instructions. instead of the expected foo.C:3: error: template instantiation depth exceeds maximum of 20000 (use -ftemplate-depth-NN to increase the maximum) instantiating 'struct foo<20000u>' foo.C:3: instantiated from 'foo<19999u>' ... foo.C:3: instantiated from 'foo<0u>' foo.C:8: instantiated from here foo.C:3: error: incomplete type 'foo<20000u>' used in nested name specifier -- Summary: When using excessive -ftemplate-depth g++ segfaults Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: gcc at magfr dot user dot lysator dot liu dot se GCC host triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27052