r/cpp • u/User_Deprecated • Jul 11 '26
Propagating exceptions from destructors with std::exception_ptr
https://www.sandordargo.com/blog/2026/07/08/exception_ptr
80
Upvotes
r/cpp • u/User_Deprecated • Jul 11 '26
View all comments
Show parent comment
4
u/azswcowboy Jul 11 '26
Thanks /u/kammce ! Was hoping you’d appear - since I’m pretty sure you know more about this than basically anyone except maybe a few compiler writers :)
So if the only try/catch is local the pointer might be invalidated - but if the thread constructor has an exception handler of last resort then it would remain valid? Still if the thread is destroyed the TLS will be gone — so one would need to be careful if that can happen.