Hi, Firstly, just to confirm, do you have a copyright assignment for GCC in place (or are covered by a corporate assignment)?
If not, please complete that process, or contribute under the DCO terms, see https://gcc.gnu.org/contribute.html#legal If the patch is being contributed under the DCO, please resubmit it with a Signed-off-by tag as per the first link :) Secondly: We will need to have two overload of address function, to preserve the qualification: In atomic_ref_bse<const _TP>, the existing one should return const _Tp* #if __glibcxx_atomic_ref >= 202411L _GLIBCXX_ALWAYS_INLINE constexpr const _Tp* address() const noexcept { return _M_ptr; } #endif // __glibcxx_atomic_ref >= 202411L And we need to also define in in atomic_ref_base<_Tp>, this will hide one from ato #if __glibcxx_atomic_ref >= 202411L _GLIBCXX_ALWAYS_INLINE constexpr _Tp* address() const noexcept { return _M_ptr; } #endif // __glibcxx_atomic_ref >= 202411L For the test I would split them into two levels: template <typename T> void test() { T x(T(42)); const std::atomic_ref<T> a(x); static_assert(noexcept(a.address())); VERIFY( std::addressof(x) == a.address() ); // I would also add a test that decltype(a.address()) is T*: // that will detect above issue. static_assert( std::is_same_v<decltype(a.address()), T*> ); } template<typename T> void test_cv() { test<T>(); test<const T>(); test<volatile T>(); test<const volatile T>(); } And then in main, you could just use: test<x>; On Fri, Oct 10, 2025 at 4:18 PM Yuao Ma <[email protected]> wrote: > On Fri, Oct 10, 2025 at 2:13 PM Tomasz Kaminski <[email protected]> > wrote: > > On Wed, Oct 8, 2025 at 11:10 AM Yuao Ma <[email protected]> wrote: > >> > >> Hi Tomasz, > >> > >> On Wed, Oct 8, 2025 at 3:27 PM Tomasz Kaminski <[email protected]> > wrote: > >> >> This patch adds support for the c++26 paper "P2835R7 Expose > >> >> std::atomic_ref's object address", including test cases and feature > >> >> test macro. Please take a look when you have time, thanks! > >> > > >> > The patch LGTM. > >> > It however conflicts with in-flight patch for cv ref support for > atomic_ref, > >> > after which this function would be implemented onces for > __atomic_ref_base<T const>. > >> > Link: > https://gcc.gnu.org/pipermail/libstdc++/2025-September/063680.html > >> > >> Thank you for informing me! Could you please ping me once this > >> refactor patch series has been merged so that I can update my patch? > >> Thank you! > > > > The refactor patch is now merged. Could you also add test for > cv-qualified > > types to your test cases in updated patch? > > > > Done! The updated patch now implements the address for > __atomic_ref_base and the testcases have added cv-qualified types. > Please take another look. > > Yuao >
