http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49763
Summary: [C++0x] A reference is not correctly captured by [=] Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: iorate_st...@yahoo.co.jp When a reference to an integral type (e.g. int) is captured by [=] of a lambda expression, the value of the captured data is not one of the referenced object, but the address of that. int main() { int const &i = 42; [=] () { std::cout << i << '\n'; << *(int *)i << '\n'; } (); // 2293396 // 42 } When the referenced type is a floating point type, ICE occurs. int main() { double const &d = 3.14; [=] () { std::cout << d << '\n'; } (); } -- ***.cpp: In function 'int main()': -- ***.cpp:***:8: internal compiler error: in convert_move, at expr.c:324 -- Please submit a full bug report, -- with preprocessed source if appropriate. -- See <http://gcc.gnu.org/bugs.html> for instructions. When the referenced type is a class type, or the reference is explictly captured by name, it works.