Boost logo

Boost :

Subject: [boost] [1.55b1][coroutine][exception] not propagating exception type
From: Jeff Flinn (Jeffrey.Flinn_at_[hidden])
Date: 2013-10-29 15:00:28


I'm on VS2013, with BOOST_COROUTINES_V1 defined. I've merged
boost::coroutine's exception test with boost::exception's
derives_std_exception test. A std::exception& is caught when based on
docs I would expect derives_std_exception to be caught. Am I doing
something obviously wrong?

Thanks, Jeff

#include <boost/coroutine/all.hpp>
#include <boost/bind.hpp>

struct derives_std_exception : std::exception {};

namespace coro = boost::coroutines;

typedef coro::coroutine< void() > coro_void_void;

template< typename E >
void f14(coro_void_void::caller_type & , E const& e)
{
   throw e;
}

int main()
{
   try
   {
     coro_void_void coro( boost::bind(f14< derives_std_exception >
                        , _1, derives_std_exception()));
        
     return -1;
   }
   catch (derives_std_exception const&)
   {
     return 0;
   }
   catch (std::exception const&)
   {
     return -1;
   }
   catch (...)
   {
     return -1;
   }
}


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk