Я понял это сам. std :: thread делает копию struct Callable
first ...
Следующее работает как ожидалось:
#include <stdexcept>
#include <iostream>
#include <thread>
int main()
{
std::exception_ptr e;
std::thread t([&e]()
{
try
{
throw std::runtime_error("Bad things happened");
}
catch (...)
{
std::cout << "caught" << std::endl;
e = std::current_exception();
if (e == NULL)
{
std::cout << "inside NULL" << std::endl;
}
}
});
t.join();
if (e == NULL)
{
std::cout << "outside NULL" << std::endl;
}
else
{
std::rethrow_exception(e);
}
return 0;
}