[committed] libstdc++: Fix testsuite warnings about new C++23 deprecations
Checks
Commit Message
Tested powerpc64le-linux. Pushed to trunk.
-- >8 --
With the recent change to deprecate std::aligned_storage and
std::aligned_union we need to adjust some tests that now fail with
-std=c++23.
libstdc++-v3/ChangeLog:
* include/std/type_traits: Add diagnostic pragmas around
references to deprecated std::aligned_storage and
std::aligned_union traits.
* testsuite/20_util/aligned_storage/requirements/alias_decl.cc:
Add dg-warning for et c++23.
* testsuite/20_util/aligned_storage/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/aligned_storage/value.cc: Likewise.
* testsuite/20_util/aligned_union/1.cc: Likewise.
* testsuite/20_util/aligned_union/requirements/alias_decl.cc:
Likewise.
---
libstdc++-v3/include/std/type_traits | 7 +++++++
.../20_util/aligned_storage/requirements/alias_decl.cc | 3 +++
.../aligned_storage/requirements/explicit_instantiation.cc | 3 +++
libstdc++-v3/testsuite/20_util/aligned_storage/value.cc | 2 ++
libstdc++-v3/testsuite/20_util/aligned_union/1.cc | 2 ++
.../20_util/aligned_union/requirements/alias_decl.cc | 3 +++
6 files changed, 20 insertions(+)
@@ -2123,6 +2123,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
? sizeof(_Tp) : __strictest_alignment<_Types...>::_S_size;
};
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
/**
* @brief Provide aligned storage for types.
*
@@ -2155,6 +2158,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template <size_t _Len, typename... _Types>
const size_t aligned_union<_Len, _Types...>::alignment_value;
+#pragma GCC diagnostic pop
/// @cond undocumented
@@ -2586,6 +2590,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ } _GLIBCXX17_DEPRECATED_SUGGEST("std::invoke_result");
#if __cplusplus >= 201402L
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
/// Alias template for aligned_storage
template<size_t _Len, size_t _Align =
__alignof__(typename __aligned_storage_msa<_Len>::__type)>
@@ -2593,6 +2599,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template <size_t _Len, typename... _Types>
using aligned_union_t _GLIBCXX23_DEPRECATED = typename aligned_union<_Len, _Types...>::type;
+#pragma GCC diagnostic pop
/// Alias template for decay
template<typename _Tp>
@@ -26,3 +26,6 @@ using namespace std;
static_assert (is_same<typename aligned_storage<4>::type,
aligned_storage_t<4>>(),
"aligned_storage_t" );
+
+// { dg-warning "deprecated" "" { target c++23 } 26 }
+// { dg-warning "deprecated" "" { target c++23 } 27 }
@@ -29,3 +29,6 @@ namespace std
template struct aligned_storage<1, alignment_of<test_type>::value>;
template struct aligned_storage<2>;
}
+
+// { dg-warning "deprecated" "" { target c++23 } 29 }
+// { dg-warning "deprecated" "" { target c++23 } 30 }
@@ -59,3 +59,5 @@ void test01()
static_assert(sizeof(aligned_storage<5>::type) >= 5, "");
static_assert(__alignof__(aligned_storage<5>::type) == align_msa, "");
}
+
+// { dg-warning "deprecated" "" { target c++23 } 0 }
@@ -64,6 +64,8 @@ void test01()
static_assert(sizeof(au_type2::type) >= max_s+100,
"Storage size (at least len)");
}
+// { dg-warning "deprecated" "" { target c++23 } 57 }
+// { dg-warning "deprecated" "" { target c++23 } 62 }
int main()
{
@@ -26,3 +26,6 @@ using namespace std;
static_assert (is_same<typename aligned_union<0, char, int>::type,
aligned_union_t<0, char, int>>(),
"aligned_union_t" );
+
+// { dg-warning "deprecated" "" { target c++23 } 26 }
+// { dg-warning "deprecated" "" { target c++23 } 27 }