[libcxx-commits] [libcxx] [libc++] Implement P0528R3 `std::atomic` CAS for types with paddings (PR #76180)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jul 3 11:28:27 PDT 2026
================
@@ -0,0 +1,243 @@
+//===----------------------------------------------------------------------===//
+//
+// 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: c++03, c++11, c++14, c++17
+
+// atomic_init is deprecated
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
+#include <atomic>
+#include <cassert>
+#include <chrono>
+#include <cstring>
+#include <type_traits>
+
+struct Foo {
----------------
ldionne wrote:
I think it would make sense to have at least a few different types being tested here. For example, with padding between two members. To make your life easier, perhaps keep limit it to two members:
```
struct Bar {
char c;
int i;
};
```
That's not a crazy increase in coverage, but it's a bit better, and it allows making the test at least somewhat generic.
https://github.com/llvm/llvm-project/pull/76180
More information about the libcxx-commits
mailing list