Test with a SVN build: $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/home/rodrigo/local/gcc/libexec/gcc/i686-pc-linux-gnu/4.5.0/lto-wrapper Target: i686-pc-linux-gnu Configured with: ../configure --prefix=/home/rodrigo/local/gcc --with-gmp=/home/rodrigo/local/gcc --with-mpfr=/home/rodrigo/local/gcc --with-mpc=/home/rodrigo/local/gcc --enable-lto --enable-languages=c,c++,lto Thread model: posix gcc version 4.5.0 20091212 (experimental) (GCC)
The attached code emits a non-sensical warning (both functions return void!). If the lambda is deleted it works as expected. $ g++ -c -std=gnu++0x -o test.o -Wall -save-temps test.cpp test.cpp: In function 'int end()': test.cpp:8:1: warning: no return statement in function returning non-void test.cpp: In function 'int start()': test.cpp:3:1: warning: control reaches end of non-void function -- Summary: in a void function: "Warning: control reaches end of non-void function" Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rodrigorivascosta at gmail dot com GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42370