http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52487
Bug #: 52487 Summary: [4.6/4.7 Regression] [C++11] ICE at cp/semantics.c:5613 with lambda capturing reference to incomplete type by value Classification: Unclassified Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: heva...@googlemail.com The following code snippet causes an ICE: struct A; void foo(A& a) { [=](){a;}; } int main() {} Confirmed with gcc version 4.6.1 20110409 (prerelease) (Ubuntu 4.6.0-3~ppa1) and GNU C++ (niXman build) version 4.7.0 20120203 (experimental) (i686-pc-mingw32) The latter prints: internal compiler error: in literal_type_p, at cp/semantics.c:5613 There is no ICE with this version: GNU C++ (Ubuntu/Linaro 4.5.2-8ubuntu4) version 4.5.2 (x86_64-linux-gnu) Instead, it prints the expected error message ("invalid use of incomplete type ‘struct A’").