On Fri, Jul 15, 2016 at 10:07:03PM +0100, Jonathan Wakely wrote: > >+ if (typeid (*this) == typeid(__pointer_type_info)) > >+ { > >+ *thr_obj = nullptr; > >+ return true;
But you have the above store too. Can't you rethrow_exception in certain threads trying to catch it as pointer to data member and in other threads as a pointer? #include <exception> #include <thread> #include <cassert> std::exception_ptr p; struct A { }; void t() { try { std::rethrow_exception(p); } catch (int A::* const& e) { assert( e == nullptr ); } } void h() { try { std::rethrow_exception(p); } catch (int *& e) { assert( e == nullptr ); } } int main() { try { throw nullptr; } catch (...) { p = std::current_exception(); } std::thread t1(t); std::thread t2(h); std::thread t3(t); std::thread t4(h); t1.join(); t2.join(); t3.join(); t4.join(); } Jakub