[libcxx-commits] [libcxx] [libc++] Add a test for the ABI of std::once_flag (PR #218924)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 26 06:57:19 PDT 2026


llvmorg-github-actions[bot] 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/218924.diff


1 Files Affected:

- (added) libcxx/test/libcxx/thread/thread.mutex/thread.once/once_flag.abi.compile.pass.cpp (+20) 


``````````diff
diff --git a/libcxx/test/libcxx/thread/thread.mutex/thread.once/once_flag.abi.compile.pass.cpp b/libcxx/test/libcxx/thread/thread.mutex/thread.once/once_flag.abi.compile.pass.cpp
new file mode 100644
index 0000000000000..c7e65574cadc0
--- /dev/null
+++ b/libcxx/test/libcxx/thread/thread.mutex/thread.once/once_flag.abi.compile.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: no-threads, c++03
+
+// <mutex>
+
+// Check the ABI of std::once_flag
+
+#include <mutex>
+#include <type_traits>
+
+static_assert(sizeof(std::once_flag) == sizeof(void*), "");
+static_assert(alignof(std::once_flag) == alignof(void*), "");
+static_assert(std::is_trivially_destructible<std::once_flag>::value, "");

``````````

</details>


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


More information about the libcxx-commits mailing list