[libcxx-commits] [PATCH] D94656: [libcxx testing] Fix UB in tests for std::lock_guard

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jan 14 07:34:36 PST 2021


ldionne requested changes to this revision.
ldionne added a comment.
This revision now requires changes to proceed.

That seems correct to me: http://eel.is/c++draft/thread.mutex#requirements.mutex.general-14

Please fix the tests in C++03 mode as suggested, though.



================
Comment at: libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/adopt_lock.pass.cpp:30-32
+    std::thread t = support::make_test_thread([](){
+      assert(m.try_lock() == false);
+    });
----------------
With `do_try_lock` defined after the global mutex:

```
void do_try_lock() {
    assert(m.try_lock() == false);
}
```

This is annoying, but those tests need to run in C++03 mode.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94656/new/

https://reviews.llvm.org/D94656



More information about the libcxx-commits mailing list