When an exception is thrown inside a function called from std::call_once, the process is aborted. The exception should be propagated outside std::call_once. #include <stdio.h> #include <mutex> #include <stdexcept> int main() { static std::once_flag flag; printf( "start\n" ); try { std::call_once( flag, [&]() { throw std::runtime_error("thrown from once"); } ); } catch ( std::runtime_error const& exc ) { printf( "%s\n", exc.what() ); } printf( "end\n" ); return 0; } bea@stbldap02:~/samples$ g++ -std=c++14 -pthread std_call_once_exception.cxx bea@stbldap02:~/samples$ ./a.out start terminate called after throwing an instance of 'std::runtime_error' what(): thrown from once IOT/Abort trap (core dumped) BTW: the system on which I tested it should be the same as in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67478
I am sorry, probably duplicate of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66146
Yes this is PR 66146 *** This bug has been marked as a duplicate of bug 66146 ***