[gcc r14-12159] libstdc++: Fix -Wdeprecated-declarations warning in <any>
Jonathan Wakely
redi@gcc.gnu.org
Fri Nov 14 15:58:25 GMT 2025
https://gcc.gnu.org/g:0c57a97066ceea1713a66a9ac9bc982c5941d1e7
commit r14-12159-g0c57a97066ceea1713a66a9ac9bc982c5941d1e7
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Fri Nov 14 10:34:21 2025 +0000
libstdc++: Fix -Wdeprecated-declarations warning in <any>
When GCC is configured with --enable-libstdcxx-pch (which is the
default) compiling 20_util/ratio/operations/ops_overflow_neg.cc with
C++23 or later triggers a warning in <any> about std::aligned_storage
being deprecated.
FAIL: 20_util/ratio/operations/ops_overflow_neg.cc -std=gnu++23 (test for excess errors)
Excess errors:
.../include/any:93: warning: 'template<long unsigned int _Len, long unsigned int _Align> struct std::aligned_storage' is deprecated [-Wdeprecated-declarations]
libstdc++-v3/ChangeLog:
* include/std/any: Add diagnostic pragmas to disable warning
about std::aligned_storage being deprecated.
Diff:
---
libstdc++-v3/include/std/any | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libstdc++-v3/include/std/any b/libstdc++-v3/include/std/any
index e4709b1ce046..974805e188f0 100644
--- a/libstdc++-v3/include/std/any
+++ b/libstdc++-v3/include/std/any
@@ -42,6 +42,9 @@
#include <type_traits>
#include <bits/utility.h> // in_place_type_t
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations" // aligned_storage
+
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -661,5 +664,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
+#pragma GCC diagnostic pop
+
#endif // __cpp_lib_any
#endif // _GLIBCXX_ANY
More information about the Libstdc++-cvs
mailing list