[libcxx-commits] [libcxx] [libc++][C++03] cherry-pick #128054 (PR #156672)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Sep 3 06:55:47 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/156672.diff


2 Files Affected:

- (modified) libcxx/include/__cxx03/__mutex/once_flag.h (+3-2) 
- (modified) libcxx/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp (-2) 


``````````diff
diff --git a/libcxx/include/__cxx03/__mutex/once_flag.h b/libcxx/include/__cxx03/__mutex/once_flag.h
index eaeaa6121bff8..529aa77071776 100644
--- a/libcxx/include/__cxx03/__mutex/once_flag.h
+++ b/libcxx/include/__cxx03/__mutex/once_flag.h
@@ -10,6 +10,7 @@
 #define _LIBCPP___CXX03___MUTEX_ONCE_FLAG_H
 
 #include <__cxx03/__config>
+#include <__cxx03/__memory/addressof.h>
 #include <__cxx03/__memory/shared_ptr.h> // __libcpp_acquire_load
 #include <__cxx03/__tuple/tuple_indices.h>
 #include <__cxx03/__tuple/tuple_size.h>
@@ -82,7 +83,7 @@ template <class _Callable>
 inline _LIBCPP_HIDE_FROM_ABI void call_once(once_flag& __flag, _Callable& __func) {
   if (__libcpp_acquire_load(&__flag.__state_) != once_flag::_Complete) {
     __call_once_param<_Callable> __p(__func);
-    std::__call_once(__flag.__state_, &__p, &__call_once_proxy<_Callable>);
+    std::__call_once(__flag.__state_, std::addressof(__p), std::addressof(__call_once_proxy<_Callable>));
   }
 }
 
@@ -90,7 +91,7 @@ template <class _Callable>
 inline _LIBCPP_HIDE_FROM_ABI void call_once(once_flag& __flag, const _Callable& __func) {
   if (__libcpp_acquire_load(&__flag.__state_) != once_flag::_Complete) {
     __call_once_param<const _Callable> __p(__func);
-    std::__call_once(__flag.__state_, &__p, &__call_once_proxy<const _Callable>);
+    std::__call_once(__flag.__state_, std::addressof(__p), std::addressof(__call_once_proxy<const _Callable>));
   }
 }
 
diff --git a/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp b/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp
index ea5b63d2804a1..121705f2e3a99 100644
--- a/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp
+++ b/libcxx/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp
@@ -8,8 +8,6 @@
 
 // UNSUPPORTED: no-threads
 
-// XFAIL: FROZEN-CXX03-HEADERS-FIXME
-
 // <mutex>
 
 // struct once_flag;

``````````

</details>


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


More information about the libcxx-commits mailing list