]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: port tests away from is_trivial
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Mon, 9 Dec 2024 01:44:30 +0000 (02:44 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 10 Dec 2024 00:50:26 +0000 (00:50 +0000)
In preparation for the deprecation of is_trivial (P3247R2).
Mostly a mechanical exercise, replacing is_trivial with
is_trivially_copyable and/or is_trivially_default_constructible
depending on the cases.

libstdc++-v3/ChangeLog:

* testsuite/20_util/specialized_algorithms/uninitialized_copy/102064.cc:
Port away from is_trivial.
* testsuite/20_util/specialized_algorithms/uninitialized_copy_n/102064.cc:
Likewise.
* testsuite/20_util/specialized_algorithms/uninitialized_default/94540.cc:
Likewise.
* testsuite/20_util/specialized_algorithms/uninitialized_default_n/94540.cc:
Likewise.
* testsuite/20_util/specialized_algorithms/uninitialized_fill/102064.cc:
Likewise.
* testsuite/20_util/specialized_algorithms/uninitialized_fill_n/102064.cc:
Likewise.
* testsuite/20_util/specialized_algorithms/uninitialized_value_construct/94540.cc:
Likewise.
* testsuite/20_util/specialized_algorithms/uninitialized_value_construct_n/94540.cc:
Likewise.
* testsuite/23_containers/vector/cons/94540.cc: Likewise.
* testsuite/25_algorithms/copy/move_iterators/69478.cc:
Likewise.
* testsuite/25_algorithms/copy_backward/move_iterators/69478.cc:
Likewise.
* testsuite/25_algorithms/move/69478.cc: Likewise.
* testsuite/25_algorithms/move_backward/69478.cc: Likewise.
* testsuite/25_algorithms/rotate/constrained.cc: Likewise.
* testsuite/25_algorithms/rotate_copy/constrained.cc: Likewise.

Signed-off-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
15 files changed:
libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/102064.cc
libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy_n/102064.cc
libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_default/94540.cc
libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_default_n/94540.cc
libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill/102064.cc
libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill_n/102064.cc
libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_value_construct/94540.cc
libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_value_construct_n/94540.cc
libstdc++-v3/testsuite/23_containers/vector/cons/94540.cc
libstdc++-v3/testsuite/25_algorithms/copy/move_iterators/69478.cc
libstdc++-v3/testsuite/25_algorithms/copy_backward/move_iterators/69478.cc
libstdc++-v3/testsuite/25_algorithms/move/69478.cc
libstdc++-v3/testsuite/25_algorithms/move_backward/69478.cc
libstdc++-v3/testsuite/25_algorithms/rotate/constrained.cc
libstdc++-v3/testsuite/25_algorithms/rotate_copy/constrained.cc

index 27d37aab09f4f7f822a167020219a4d6dec1fea8..83caaaec13760bb0499fb2fdaa3c17934c81a8ef 100644 (file)
@@ -19,7 +19,8 @@ private:
 Y::operator X() const { return X(); }
 
 #if __cplusplus >= 201103L
-static_assert( std::is_trivial<X>::value, "" );
+static_assert( std::is_trivially_default_constructible<X>::value, "" );
+static_assert( std::is_trivially_copyable<X>::value, "" );
 #endif
 
 void test01_pr102064()
@@ -40,7 +41,8 @@ struct Z
   Z& operator=(int) = delete;
 };
 
-static_assert( std::is_trivial<Z>::value, "" );
+static_assert( std::is_trivially_default_constructible<Z>::value, "" );
+static_assert( std::is_trivially_copyable<Z>::value, "" );
 
 void test02_pr102064()
 {
index 963e1531a71bba0c3fd5d7a5c9febd89b8529a72..bb0850a34c1d1d432ad85e0b25b17aabcc41f071 100644 (file)
@@ -18,7 +18,8 @@ private:
 
 Y::operator X() const { return X(); }
 
-static_assert( std::is_trivial<X>::value, "" );
+static_assert( std::is_trivially_default_constructible<X>::value, "" );
+static_assert( std::is_trivially_copyable<X>::value, "" );
 
 void test01_pr102064()
 {
@@ -37,7 +38,8 @@ struct Z
   Z& operator=(int) = delete;
 };
 
-static_assert( std::is_trivial<Z>::value, "" );
+static_assert( std::is_trivially_default_constructible<Z>::value, "" );
+static_assert( std::is_trivially_copyable<Z>::value, "" );
 
 void test02_pr102064()
 {
index 609fd268948a84250a676bba6abef25645d6bca2..20716cba987f02d6ca34a4cda1e3f9cdc27dc23c 100644 (file)
@@ -23,7 +23,8 @@
 // Assume that 9MB is larger than the stack limit.
 struct X { char data[9*1024*1024]; };
 
-static_assert( std::is_trivial<X>::value, "" );
+static_assert( std::is_trivially_default_constructible<X>::value, "" );
+static_assert( std::is_trivially_copyable<X>::value, "" );
 
 int main()
 {
index fae3cf59587088061e8e6ccab074111315e0c4af..2368aae5628933bae4e27de49e1470d6ebea5ec7 100644 (file)
@@ -23,7 +23,8 @@
 // Assume that 9MB is larger than the stack limit.
 struct X { char data[9*1024*1024]; };
 
-static_assert( std::is_trivial<X>::value, "" );
+static_assert( std::is_trivially_default_constructible<X>::value, "" );
+static_assert( std::is_trivially_copyable<X>::value, "" );
 
 int main()
 {
index 7eb49b543a41bf07035045cb44ce870c6f2fdb6f..14827cf932558b01e4264aa63a46fed33973a316 100644 (file)
@@ -19,7 +19,8 @@ private:
 Y::operator X() const { return X(); }
 
 #if __cplusplus >= 201103L
-static_assert( std::is_trivial<X>::value, "" );
+static_assert( std::is_trivially_default_constructible<X>::value, "" );
+static_assert( std::is_trivially_copyable<X>::value, "" );
 #endif
 
 void test01_pr102064()
@@ -40,7 +41,8 @@ struct Z
   Z& operator=(int) = delete;
 };
 
-static_assert( std::is_trivial<Z>::value, "" );
+static_assert( std::is_trivially_default_constructible<Z>::value, "" );
+static_assert( std::is_trivially_copyable<Z>::value, "" );
 
 void test02_pr102064()
 {
index e4f2139cf6da31718ec23442d2bd2ab42185f81a..3bac1ece67c66be66de705021cb54f3b16961345 100644 (file)
@@ -19,7 +19,8 @@ private:
 Y::operator X() const { return X(); }
 
 #if __cplusplus >= 201103L
-static_assert( std::is_trivial<X>::value, "" );
+static_assert( std::is_trivially_default_constructible<X>::value, "" );
+static_assert( std::is_trivially_copyable<X>::value, "" );
 #endif
 
 void test01_pr102064()
@@ -40,7 +41,8 @@ struct Z
   Z& operator=(int) = delete;
 };
 
-static_assert( std::is_trivial<Z>::value, "" );
+static_assert( std::is_trivially_default_constructible<Z>::value, "" );
+static_assert( std::is_trivially_copyable<Z>::value, "" );
 
 void test02_pr102064()
 {
index e891e81df933a5cdf53243c10459b92ec378e122..4c5af9d8c7b9aad063c1ca2abd1f55f028ef6c18 100644 (file)
@@ -23,7 +23,8 @@
 // Assume that 9MB is larger than the stack limit.
 struct X { char data[9*1024*1024]; };
 
-static_assert( std::is_trivial_v<X> );
+static_assert( std::is_trivially_copyable_v<X> );
+static_assert( std::is_trivially_default_constructible_v<X> );
 
 int main()
 {
index 1c4db602490a63527df73eeda3b6115835263edc..a1ee31c741345c3c57e1ca83f576d5673d139f86 100644 (file)
@@ -23,7 +23,8 @@
 // Assume that 9MB is larger than the stack limit.
 struct X { char data[9*1024*1024]; };
 
-static_assert( std::is_trivial_v<X> );
+static_assert( std::is_trivially_copyable_v<X> );
+static_assert( std::is_trivially_default_constructible_v<X> );
 
 int main()
 {
index 603c1ec1d3e994621bf081f9bb8978a42911009a..1691a75434f01062103273b05565cc21d797f248 100644 (file)
@@ -23,7 +23,8 @@
 // Assume that 9MB is larger than the stack limit.
 struct X { char data[9*1024*1024]; };
 
-static_assert( std::is_trivial<X>::value, "" );
+static_assert( std::is_trivially_default_constructible<X>::value, "" );
+static_assert( std::is_trivially_copyable<X>::value, "" );
 
 int main()
 {
index 2d0ff728b8c0fd3151a846cbaf940c0e17d9373c..84ead4831a6b79b1c8182790be316d42de8823cc 100644 (file)
@@ -32,7 +32,8 @@ test01()
     trivial_rvalstruct(trivial_rvalstruct&&) = default;
     trivial_rvalstruct& operator=(trivial_rvalstruct&&) = default;
   };
-  static_assert(std::is_trivial<trivial_rvalstruct>::value, "");
+  static_assert(std::is_trivially_default_constructible<trivial_rvalstruct>::value, "");
+  static_assert(std::is_trivially_copyable<trivial_rvalstruct>::value, "");
 
   trivial_rvalstruct a[1], b[1];
   copy(std::make_move_iterator(a), std::make_move_iterator(a + 1), b);
index 572eaab8eff1625fed88abe89be19e5c08896997..dde85ad8545d4eec4d704bd5f14fe06353089504 100644 (file)
@@ -32,7 +32,8 @@ test01()
     trivial_rvalstruct(trivial_rvalstruct&&) = default;
     trivial_rvalstruct& operator=(trivial_rvalstruct&&) = default;
   };
-  static_assert(std::is_trivial<trivial_rvalstruct>::value, "");
+  static_assert(std::is_trivially_default_constructible<trivial_rvalstruct>::value, "");
+  static_assert(std::is_trivially_copyable<trivial_rvalstruct>::value, "");
 
   trivial_rvalstruct a[1], b[1];
   copy_backward(std::make_move_iterator(a), std::make_move_iterator(a+1), b+1);
index 3cad8c8304a85ecf1226b030382364c64fb585ba..04a369080b1216001af7f285712c1ec077b85438 100644 (file)
@@ -32,7 +32,8 @@ test01()
     trivial_rvalstruct(trivial_rvalstruct&&) = default;
     trivial_rvalstruct& operator=(trivial_rvalstruct&&) = default;
   };
-  static_assert(std::is_trivial<trivial_rvalstruct>::value, "");
+  static_assert(std::is_trivially_default_constructible<trivial_rvalstruct>::value, "");
+  static_assert(std::is_trivially_copyable<trivial_rvalstruct>::value, "");
 
   trivial_rvalstruct a[1], b[1];
   std::move(a, a + 1, b);
index 5892f0b38abde273544540952c973509426f9da9..9a88dae4d5ebde6ca723d4869b5661536237896a 100644 (file)
@@ -32,7 +32,8 @@ test01()
     trivial_rvalstruct(trivial_rvalstruct&&) = default;
     trivial_rvalstruct& operator=(trivial_rvalstruct&&) = default;
   };
-  static_assert(std::is_trivial<trivial_rvalstruct>::value, "");
+  static_assert(std::is_trivially_default_constructible<trivial_rvalstruct>::value, "");
+  static_assert(std::is_trivially_copyable<trivial_rvalstruct>::value, "");
 
   trivial_rvalstruct a[1], b[1];
   std::move_backward(a, a + 1, b + 1);
index 33f2633dfdd7c8af2b4b674b741406caf4ae0c90..37a47e10b10b3a69b8161b1ee967401f67b63477 100644 (file)
@@ -41,7 +41,7 @@ struct X
   }
 };
 
-static_assert(!std::is_trivial_v<X>);
+static_assert(!std::is_trivially_default_constructible_v<X>);
 
 template<template<typename, template<typename> typename> typename container,
         template<typename> typename wrapper,
index 2907e3bc5b31015a6e7cdbdbcd61cccf6927e00d..85afbe3ea731523a2c171ba4e34d7d4963e0f001 100644 (file)
@@ -41,7 +41,7 @@ struct X
   }
 };
 
-static_assert(!std::is_trivial_v<X>);
+static_assert(!std::is_trivially_default_constructible_v<X>);
 
 template<template<typename, template<typename> typename> typename container,
         template<typename> typename wrapper,