[libcxx-commits] [libcxx] [libc++][atomic] P2835R7: Expose `std::atomic_ref`'s object address (PR #162236)
Hristo Hristov via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Oct 7 07:59:14 PDT 2025
================
@@ -0,0 +1,37 @@
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: std-at-least-c++26
+
+// XFAIL: !has-64-bit-atomics
+// XFAIL: !has-1024-bit-atomics
+
+// constexpr T* address() const noexcept;
+
+#include <atomic>
+#include <cassert>
+
+#include "atomic_helpers.h"
+#include "test_macros.h"
+
+template <typename T>
+struct TestAddress {
+ void operator()() const {
+ T x(T(1));
+ std::atomic_ref<T> const a(x);
+
+ assert(a.address() == std::addressof(x));
+
+ static_assert(noexcept((a.address())));
----------------
H-G-Hristov wrote:
I think it makes sense to complete it after #118382 (P3309R3: constexpr atomic and atomic_ref)
https://github.com/llvm/llvm-project/pull/162236
More information about the libcxx-commits
mailing list