[libcxx-commits] [libcxx] [libc++][ThreadSafety] Add thread safety annotations for variadic std::scoped_lock (PR #204462)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 19 10:32:50 PDT 2026


================
@@ -65,6 +65,9 @@ Improvements and New Features
   ``"std::visit: variant is valueless"``, ``"std::get: variant is valueless"``, or
   ``"std::get: wrong alternative for variant"``. The standard only requires ``what()`` to return an
   unspecified non-null string, so user code that does not match on the exact message remains correct.
+- ``std::scoped_lock`` now carries Clang thread safety annotations when locking multiple mutexes, so
+  ``-Wthread-safety`` no longer incorrectly reports the guarded data accessed inside the block as
+  unprotected. This requires Clang 21 or later. This fixes `#42000 <https://github.com/llvm/llvm-project/issues/42000>`_.
----------------
AnthonyCalandraGeotab wrote:

Done!

https://github.com/llvm/llvm-project/pull/204462


More information about the libcxx-commits mailing list