it resembles Bug 41896 but with the addition of line: auto val = val; The code is legal but doesn't make any sense. In some rare cases which I couldn't replicate simply, it went into an infinite mallo, consuming the whole memory, instead of segfault.
float nested_lambda() { float val; [val]() { auto val = val; [val]() { }; }; } g++: Internal error: Segmentation Fault (program cc1plus) Please submit a full bug report. See <http://gcc.gnu.org/bugs.html> for instructions. g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/home/rakadam/streamplusplus/local/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../configure --enable-languages=c,c++ --program-suffix=-4.5 --prefix=/home/rakadam/streamplusplus/src/third_party/gcc-trunk/build_gcc/../../../../local --enable-lto --disable-bootstrap --enable-gold Thread model: posix gcc version 4.5.0 20100306 (experimental) (GCC) -- Summary: [c++0x] ICE in nested lambda functions, in a special case Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: adam dot rak at streamnovation dot com GCC build triplet: x86_64-unknown-linux GCC host triplet: x86_64-unknown-linux GCC target triplet: x86_64-unknown-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43281