Hi,

I use boost coroutines and I have realized that in my environment (Visual Studio 2015 Update 1, x64)  I cannot catch the exception type of a custom exception.

The example below demonstrates the case. I have a custom exception derived from a std::runime_error. In the main function I want to catch my custom exception type that was thrown in the coroutine.
However somehow I always end up in the catch branch of the std::runtime_error.

Are custom exceptions are not supported by the coroutines library?


Regards,
Tamas

class MyError : public std::runtime_error
{
public:
        MyError()
                : runtime_error("rt error")
        {
        }

        explicit MyError(char const* _Message)
                : runtime_error(_Message)
        {
        }


        explicit MyError(runtime_error const& _Other)
                : runtime_error(_Other)
        {
        }
};

void cooperative(boost::coroutines::coroutine<void>::push_type &sink)
{
        sink();
        throw MyError("error");
}

void main()
        {

                boost::coroutines::coroutine<void>::pull_type source(&cooperative);
                try
                {
                        source();
                }
                catch (const MyError &e)
                {
                        std::cerr << e.what() << '\n';
                }
                catch (const std::runtime_error &e)
                {
                        std::cerr << e.what() << '\n';
                }
                catch (const std::exception &e)
                {
                        std::cerr << e.what() << '\n';
                }
        }