[coroutine] MinGW: terminate called after throwing an instance of 'boost::context::detail::forced_unwind'

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[coroutine] MinGW: terminate called after throwing an instance of 'boost::context::detail::forced_unwind'

Boost - Users mailing list
Hi :)

I've tried to compile this simple Boost.Coroutine example:


#include <iostream>
#include <boost/coroutine2/all.hpp>

void foo(boost::coroutines2::asymmetric_coroutine<void>::push_type& yield) {
        for (int i = 0; i < 10; ++i) {
                std::cout << i << std::endl;
                yield();
        }
}

int main() {
        boost::coroutines2::asymmetric_coroutine<void>::pull_type coroutine(foo);
        for (int i = 0; i < 5; ++i) {
                coroutine();
        }
}


On Linux this works as expected, just as on Windows with Visual Studio. But when I cross-compile on Linux using


i686-w64-mingw32-g++ src/main.cpp -lboost_context-mt


The resulting exe crashes with:


0
1
2
3
4
5
6
terminate called after throwing an instance of 'boost::context::detail::forced_unwind'

abnormal program termination


There's a similar problem on StackOverflow: https://stackoverflow.com/questions/45569418/how-to-use-boost-context-correctly
But I'm having the crash only with the cross-compiled version, not MSVC. Am I doing something wrong? Or might this be a bug in Fedora's mingw32-boost package?
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users