This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/47263] New: [C++0x] lambda + dynamic-exception-specification std::unexpected() is not called.


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

           Summary: [C++0x] lambda + dynamic-exception-specification
                    std::unexpected() is not called.
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: flast@flast.jp


In GCC4.5/4.6, if lambda throws unexpected exception, std::unexpected() is not
called but std::terminate() is called immidiately.

test code:
#include <exception>
#include <cstdio>
#include <cstdlib>
using namespace std;

int main( void )
{
    set_unexpected( []{ puts( "unexpected" ); fflush( stdout ); throw 0; } );
    set_terminate( []{ puts( "terminate" ); fflush( stdout ); abort(); } );
    try
    {
        []() throw( int ) { throw exception(); }();
    }
    catch( int )
    {
        puts( "catch" );
    }
}

output:
$ ./a.out
terminate
zsh: abort      ./a.out


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]