From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3893 invoked by alias); 10 Feb 2011 19:53:34 -0000 Received: (qmail 3881 invoked by uid 22791); 10 Feb 2011 19:53:33 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 10 Feb 2011 19:53:27 +0000 From: "vituscze at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/47688] New: [C++0x] Segfault when assigning lambda to std::function variable X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vituscze at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Date: Thu, 10 Feb 2011 19:56:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-02/txt/msg01361.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D47688 Summary: [C++0x] Segfault when assigning lambda to std::function variable Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: vituscze@gmail.com Created attachment 23301 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=3D23301 Output of -save-temps Hello, g++ crashes while compiling following code (if it is of any use): #include int main() { std::function f =3D [] (int& x) // type mismatch on purpose { x +=3D 3; }; } Command line: g++ -std=3Dc++0x -Wall crash2.cpp Compiler crashes with following error: In file included from crash2.cpp:1:0: c:\gcc\bin\../lib/gcc/i686-pc-mingw32/4.6.0/../../../../include/c++/4.6.0/f= unctional: In static member function 'static void std::_Function_handler::_M_invoke(const std::_Any_data&, _ArgTypes ...) [with _Fun= ctor =3D main()::, _ArgTypes =3D {int}]': c:\gcc\bin\../lib/gcc/i686-pc-mingw32/4.6.0/../../../../include/c++/4.6.0/f= unctional:2135:6: instantiated from 'std::function<_Res(_ArgTypes ...)>::function(_Functor, typename std::enable_if<(! std::is_integral<_Functor>::value), std::function<_Res(_ArgTypes ...)>::_Useless>::type) [with _Functor =3D main()::, _Res =3D void, _ArgTypes =3D {int}, typename std::enable_if<(! std::is_integral<_Functor>::value), std::function<_Res(_ArgTypes ...)>::_Useless>::type =3D std::function::_Useless]' crash2.cpp:8:2: instantiated from here c:\gcc\bin\../lib/gcc/i686-pc-mingw32/4.6.0/../../../../include/c++/4.6.0/f= unctional:1765:9: error: no match for call to '(main()::) (int)' crash2.cpp:5:34: note: candidates are: c:\gcc\bin\../lib/gcc/i686-pc-mingw32/4.6.0/../../../../include/c++/4.6.0/f= unctional:1765:9: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See for instructions. Using GCC 4.6.0 20110205 on Windows Vista (32bit). Output of g++ -v: Built by Equation Solution . Using built-in specs. COLLECT_GCC=3Dg++ COLLECT_LTO_WRAPPER=3Dc:/gcc/bin/../libexec/gcc/i686-pc-mingw32/4.6.0/lto-w= rapper.exe Target: i686-pc-mingw32 Configured with: ../gcc-4.6-20110205-mingw/configure --host=3Di686-pc-mingw= 32 --build=3Dx86_64-unknown-linux-gnu --target=3Di686-pc-mingw32 --prefix=3D/home/gfortran/gcc-home/binary/mingw32/native/x86_32/gcc/4.6-201= 10205 --with-lto-plugin --with-gcc --with-gnu-ld --with-gnu-as --with-host-libstdcxx=3D'-lstdc++ -lsupc++ -lm' --with-ppl=3D/home/gfortran/gcc-home/binary/mingw32/native/x86_32/ppl --with-cloog=3D/home/gfortran/gcc-home/binary/mingw32/native/x86_32/cloog --with-gmp=3D/home/gfortran/gcc-home/binary/mingw32/native/x86_32/gmp --with-mpfr=3D/home/gfortran/gcc-home/binary/mingw32/native/x86_32/mpfr --with-mpc=3D/home/gfortran/gcc-home/binary/mingw32/native/x86_32/mpc --with-sysroot=3D/home/gfortran/gcc-home/binary/mingw32/cross/x86_32/gcc/4.= 6-20110205 --enable-languages=3Dc,c++,fortran --enable-libgomp --enable-threads=3Dwin32 --enable-lto --enable-static --enable-cloog-backend=3Dppl --disable-shared --disable-nls --disable-tls --disable-win32-registry Thread model: win32 gcc version 4.6.0 20110205 (experimental) (GCC) Output of g++ -std=3Dc++0x crash2.cpp -save-temps is in attachment. Thanks for your time, V=C3=ADt =C5=A0efl