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

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 3 05:47:09 PDT 2026


https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/220857

>From 0d06c38c69c934a5f96d01a5132c899a3dd1374b Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Thu, 3 Sep 2026 11:45:43 +0200
Subject: [PATCH] [libc++] Add a test for the ABI of std::locale::id

---
 .../locale.id/id.abi.compile.pass.cpp         | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 libcxx/test/libcxx/localization/locales/locale/locale.types/locale.id/id.abi.compile.pass.cpp

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



More information about the libcxx-commits mailing list