I’ve just spent a lot of time trying to figure out why a particular class of tests were failing for me with MSVC and not with GCC.
These tests are designed to check that std::condition_variable::wait_for (and friends) will call std::terminate when an exception is thrown during the re-locking of the passed in mutex.
Firstly, I think this is C++14 only, at least according to http://en.cppreference.com/w/cpp/thread/condition_variable/wait_for. I know that’s not the single source of truth so please correct me if that’s not the case. If it is, then I’d like to comment out these tests in a:
#if _LIBCPP_STD_VER > 11
Secondly, I’d like to add a much more verbose comment as to what these tests are doing and why, ultimately, they will work. The latter point is the more important. To implement the expected behaviour the tests rely on the dtr of std::unique_ptr calling a nothrow function and the mutex locking happening from within there (this is why MSVC failed the test as it doesn’t call std::terminate if a throw occurs in a nothrow function).
I’ll submit a patch (or not) based on comments.
Also, on a side not whilst I remember. The following functions in condition_variable.cpp are marked as NOTHROW but actually can throw:
chrono::time_point<chrono::system_clock, chrono::nanoseconds> tp)
Seems like a bug to me! Is it?