[libcxx-commits] [libcxx] [libc++] Add a test for the ABI of std::locale::id (PR #220857)
via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Sep 3 07:48:17 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/220857.diff
1 Files Affected:
- (added) libcxx/test/libcxx/localization/locales/locale/locale.types/locale.id/id.abi.compile.pass.cpp (+29)
``````````diff
diff --git a/libcxx/test/libcxx/localization/locales/locale/locale.types/locale.id/id.abi.compile.pass.cpp b/libcxx/test/libcxx/localization/locales/locale/locale.types/locale.id/id.abi.compile.pass.cpp
new file mode 100644
index 0000000000000..4db686c5941aa
--- /dev/null
+++ b/libcxx/test/libcxx/localization/locales/locale/locale.types/locale.id/id.abi.compile.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// 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::locale::id
+
+#include <cstdint>
+#include <locale>
+#include <type_traits>
+
+static_assert(sizeof(std::locale::id) == 2 * sizeof(std::uintptr_t), "");
+static_assert(alignof(std::locale::id) == alignof(std::uintptr_t), "");
+static_assert(std::is_trivially_destructible<std::locale::id>::value, "");
+
+struct IDLayout {
+ IDLayout() {}
+ uintptr_t a;
+ int32_t b;
+};
+
+static_assert(std::__datasizeof_v<std::locale::id> == std::__datasizeof_v<IDLayout>, "");
``````````
</details>
https://github.com/llvm/llvm-project/pull/220857
More information about the libcxx-commits
mailing list