Per version.syn#2, <memory> is required to define
__cpp_lib_addressof_constexpr as 201603L.

Bootstrapped and tested on aarch64-linux-gnu.

Signed-off-by: Dhruv Chawla <dhr...@nvidia.com>

libstdc++-v3/ChangeLog:
        * include/std/memory: Define __glibcxx_want_addressof_constexpr.
        * testsuite/20_util/headers/memory/version.cc: Test for macro
        value.
---
 libstdc++-v3/include/std/memory                          | 1 +
 libstdc++-v3/testsuite/20_util/headers/memory/version.cc | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/libstdc++-v3/include/std/memory b/libstdc++-v3/include/std/memory
index 99f542dcddc..78a1250d29a 100644
--- a/libstdc++-v3/include/std/memory
+++ b/libstdc++-v3/include/std/memory
@@ -97,6 +97,7 @@
 #  include <bits/out_ptr.h>
 #endif
+#define __glibcxx_want_addressof_constexpr
 #define __glibcxx_want_allocator_traits_is_always_equal
 #define __glibcxx_want_assume_aligned
 #define __glibcxx_want_atomic_shared_ptr
diff --git a/libstdc++-v3/testsuite/20_util/headers/memory/version.cc 
b/libstdc++-v3/testsuite/20_util/headers/memory/version.cc
index c82c9a018e0..946955dd212 100644
--- a/libstdc++-v3/testsuite/20_util/headers/memory/version.cc
+++ b/libstdc++-v3/testsuite/20_util/headers/memory/version.cc
@@ -6,3 +6,7 @@
 #if __cpp_lib_allocator_traits_is_always_equal != 201411L
 # error "Feature-test macro __cpp_lib_allocator_traits_is_always_equal has wrong value in 
<version>"
 #endif
+
+#if __cpp_lib_addressof_constexpr != 201603L
+# error "Feature-test macro __cpp_lib_addressof_constexpr has wrong value in 
<version>"
+#endif
--
2.44.0

From 9afa53d193ebeddd1682811909e36515fe4a54d7 Mon Sep 17 00:00:00 2001
From: Dhruv Chawla <dhr...@nvidia.com>
Date: Tue, 8 Apr 2025 01:01:24 -0700
Subject: [PATCH] libstdc++: Add missing feature-test macro in <memory>

Per version.syn#2, <memory> is required to define
__cpp_lib_addressof_constexpr as 201603L.

Bootstrapped and tested on aarch64-linux-gnu.

Signed-off-by: Dhruv Chawla <dhr...@nvidia.com>

libstdc++-v3/ChangeLog:
        * include/std/memory: Define __glibcxx_want_addressof_constexpr.
        * testsuite/20_util/headers/memory/version.cc: Test for macro
        value.
---
 libstdc++-v3/include/std/memory                          | 1 +
 libstdc++-v3/testsuite/20_util/headers/memory/version.cc | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/libstdc++-v3/include/std/memory b/libstdc++-v3/include/std/memory
index 99f542dcddc..78a1250d29a 100644
--- a/libstdc++-v3/include/std/memory
+++ b/libstdc++-v3/include/std/memory
@@ -97,6 +97,7 @@
 #  include <bits/out_ptr.h>
 #endif
 
+#define __glibcxx_want_addressof_constexpr
 #define __glibcxx_want_allocator_traits_is_always_equal
 #define __glibcxx_want_assume_aligned
 #define __glibcxx_want_atomic_shared_ptr
diff --git a/libstdc++-v3/testsuite/20_util/headers/memory/version.cc 
b/libstdc++-v3/testsuite/20_util/headers/memory/version.cc
index c82c9a018e0..946955dd212 100644
--- a/libstdc++-v3/testsuite/20_util/headers/memory/version.cc
+++ b/libstdc++-v3/testsuite/20_util/headers/memory/version.cc
@@ -6,3 +6,7 @@
 #if __cpp_lib_allocator_traits_is_always_equal != 201411L
 # error "Feature-test macro __cpp_lib_allocator_traits_is_always_equal has 
wrong value in <version>"
 #endif
+
+#if __cpp_lib_addressof_constexpr != 201603L
+# error "Feature-test macro __cpp_lib_addressof_constexpr has wrong value in 
<version>"
+#endif
-- 
2.44.0

Reply via email to