http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52026
Bug #: 52026 Summary: [c++0x] g++: Constexpr Variable Appears Uninitialized in Lambda Classification: Unclassified Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: chees...@gmail.com Created attachment 26487 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26487 The code sample exhibiting the suspected bug. Hello everyone, In the code fragment below, g++ (4.6.1 on Linux Mint 64-bit) complains that x is uninitialized in the lambda function, and prints out an initialized value from the stack for the last three lines of the program's output. I'd except all four lines of the output to be '5', so I suspect that this may be a compiler bug. Also, even without the reference-capture in the lambda function, the code still compiles. Below follows the command used to compile the code, along with one possible output. # g++ -Wall -std=c++0x c.cpp c.cpp: In lambda function: c.cpp:25:4: warning: ‘x’ is used uninitialized in this function [-Wuninitialized] # ./a.out 5 32535 32535 32535