The following code causes an ICE in gcc-4.5.0.  An error should be reported (as
per n3092, 5.1.2/4) owing to the fact that the return statement is invalid - a
brace-init-list is not an expression and hence the return type is void.

23:38:33 Paul bibbi...@jijou
/cygdrive/d/CPPProjects/nano/gcc_bugs $cat _5_1_2_4.cpp
int main()
{
   auto x2 = []{ return { 1, 2 }; };
}


23:39:08 Paul bibbi...@jijou
/cygdrive/d/CPPProjects/nano/gcc_bugs $i686-pc-cygwin-gcc-4.5.0 -Wall
-save-temps -std=c++0x -c _5_1_2_4.cpp
_5_1_2_4.cpp: In lambda function:
_5_1_2_4.cpp:3:32: internal compiler error: in convert_like_real, at
cp/call.c:4929
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


23:43:24 Paul bibbi...@jijou
/cygdrive/d/CPPProjects/nano/gcc_bugs $i686-pc-cygwin-gcc-4.5.0 -v
Using built-in specs.
COLLECT_GCC=i686-pc-cygwin-gcc-4.5.0
COLLECT_LTO_WRAPPER=/opt/gcc-4.5.0/libexec/gcc/i686-pc-cygwin/4.5.0/lto-wrapper.exe
Target: i686-pc-cygwin
Configured with: ./configure --prefix=/opt/gcc-4.5.0 --enable-bootstrap
--enable-version-specific-runtime-libs --enable-static --enable-shared
--enable-shared-libgcc --disable-__cxa_atexit --with-gnu-ld --with-gnu-as
--with-dwarf2 --disable-sjlj-exceptions --enable-languages=c,c++
--disable-symvers --enable-libgomp --enable-libssp --enable-threads=posix
--with-arch-i686 --with-tune=generic
Thread model: posix
gcc version 4.5.0 (GCC)


23:44:15 Paul bibbi...@jijou
/cygdrive/d/CPPProjects/nano/gcc_bugs $cat _5_1_2_4.ii
# 1 "_5_1_2_4.cpp"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "_5_1_2_4.cpp"
int main()
{
   auto x2 = []{ return { 1, 2 }; };
}


-- 
           Summary: gcc-4.5.0 - ICE on invalid lambda return
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: paul dot bibbings at gmail dot com
  GCC host triplet: i686-pc-cygwin


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43875

Reply via email to