]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix testsuite warnings about new C++23 deprecations
authorJonathan Wakely <jwakely@redhat.com>
Sat, 4 Feb 2023 00:04:55 +0000 (00:04 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 6 Feb 2023 14:23:47 +0000 (14:23 +0000)
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
libstdc++-v3/testsuite/20_util/aligned_storage/requirements/alias_decl.cc
libstdc++-v3/testsuite/20_util/aligned_storage/requirements/explicit_instantiation.cc
libstdc++-v3/testsuite/20_util/aligned_storage/value.cc
libstdc++-v3/testsuite/20_util/aligned_union/1.cc
libstdc++-v3/testsuite/20_util/aligned_union/requirements/alias_decl.cc

index d13af433a17f25b98d3ec100e18c2e7f70a173fc..2bd607a8b8ff52aba6fd205ab1af2bc4b92f78d0 100644 (file)
@@ -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>
index fc230b66a9d186dfd23e179b9206998d393356dc..2e8e90efcd788ebcbed2b0b24d18b3b3880777cb 100644 (file)
@@ -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 }
index 36dfe04b083a65968614b1f2ce3854f8773b494e..baec6667f306cf9e918a0ec54af09d07e3a1d07b 100644 (file)
@@ -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 }
index 16a5580a6b7973caf90b83e84d6e7ee7d547f9ee..6e9df7ffc5d114ad473aaf78ee35cebc579330cb 100644 (file)
@@ -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 }
index b779884dcc22cdddcdd324afda627c0588e4ff0f..7501529cbf4fa37e1f717a1246571ddf002d2a32 100644 (file)
@@ -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()
 {
index 6790d2aa828c8dcff04fdb663dfc9086997e6b4e..41f2b0881af562a2fb91af15ca4720d2c2f215d3 100644 (file)
@@ -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 }