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

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 26 06:56:39 PDT 2026


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

None

>From 277b9cbfd5f852927821541637a85ec241db9b6b Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Wed, 26 Aug 2026 15:56:19 +0200
Subject: [PATCH] [libc++] Add a test for the ABI of std::once_flag

---
 .../once_flag.abi.compile.pass.cpp            | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 libcxx/test/libcxx/thread/thread.mutex/thread.once/once_flag.abi.compile.pass.cpp

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, "");



More information about the libcxx-commits mailing list