[PATCH 5/6] libstdc++: port tests away from is_trivial

Jonathan Wakely jwakely@redhat.com
Mon Dec 9 13:48:31 GMT 2024


On 09/12/24 13:22 +0100, Giuseppe D'Angelo wrote:
>Hello,
>
>This ports some misc test away from is_trivial.

This is fine, thanks.

>Thanks,
>-- 
>Giuseppe D'Angelo

>From 7b0548ee8732b5211a50cba7781b4fe25d9f5f04 Mon Sep 17 00:00:00 2001
>From: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
>Date: Mon, 9 Dec 2024 02:44:30 +0100
>Subject: [PATCH 5/6] libstdc++: port tests away from is_trivial
>
>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>
>---
> .../specialized_algorithms/uninitialized_copy/102064.cc     | 6 ++++--
> .../specialized_algorithms/uninitialized_copy_n/102064.cc   | 6 ++++--
> .../specialized_algorithms/uninitialized_default/94540.cc   | 3 ++-
> .../specialized_algorithms/uninitialized_default_n/94540.cc | 3 ++-
> .../specialized_algorithms/uninitialized_fill/102064.cc     | 6 ++++--
> .../specialized_algorithms/uninitialized_fill_n/102064.cc   | 6 ++++--
> .../uninitialized_value_construct/94540.cc                  | 3 ++-
> .../uninitialized_value_construct_n/94540.cc                | 3 ++-
> libstdc++-v3/testsuite/23_containers/vector/cons/94540.cc   | 3 ++-
> .../testsuite/25_algorithms/copy/move_iterators/69478.cc    | 3 ++-
> .../25_algorithms/copy_backward/move_iterators/69478.cc     | 3 ++-
> libstdc++-v3/testsuite/25_algorithms/move/69478.cc          | 3 ++-
> libstdc++-v3/testsuite/25_algorithms/move_backward/69478.cc | 3 ++-
> libstdc++-v3/testsuite/25_algorithms/rotate/constrained.cc  | 2 +-
> .../testsuite/25_algorithms/rotate_copy/constrained.cc      | 2 +-
> 15 files changed, 36 insertions(+), 19 deletions(-)
>
>diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/102064.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/102064.cc
>index 27d37aab09f..83caaaec137 100644
>--- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/102064.cc
>+++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/102064.cc
>@@ -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()
> {
>diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy_n/102064.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy_n/102064.cc
>index 963e1531a71..bb0850a34c1 100644
>--- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy_n/102064.cc
>+++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy_n/102064.cc
>@@ -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()
> {
>diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_default/94540.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_default/94540.cc
>index 609fd268948..20716cba987 100644
>--- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_default/94540.cc
>+++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_default/94540.cc
>@@ -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()
> {
>diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_default_n/94540.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_default_n/94540.cc
>index fae3cf59587..2368aae5628 100644
>--- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_default_n/94540.cc
>+++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_default_n/94540.cc
>@@ -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()
> {
>diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill/102064.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill/102064.cc
>index 7eb49b543a4..14827cf9325 100644
>--- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill/102064.cc
>+++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill/102064.cc
>@@ -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()
> {
>diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill_n/102064.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill_n/102064.cc
>index e4f2139cf6d..3bac1ece67c 100644
>--- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill_n/102064.cc
>+++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill_n/102064.cc
>@@ -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()
> {
>diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_value_construct/94540.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_value_construct/94540.cc
>index e891e81df93..4c5af9d8c7b 100644
>--- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_value_construct/94540.cc
>+++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_value_construct/94540.cc
>@@ -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()
> {
>diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_value_construct_n/94540.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_value_construct_n/94540.cc
>index 1c4db602490..a1ee31c7413 100644
>--- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_value_construct_n/94540.cc
>+++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_value_construct_n/94540.cc
>@@ -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()
> {
>diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/94540.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/94540.cc
>index 603c1ec1d3e..1691a75434f 100644
>--- a/libstdc++-v3/testsuite/23_containers/vector/cons/94540.cc
>+++ b/libstdc++-v3/testsuite/23_containers/vector/cons/94540.cc
>@@ -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()
> {
>diff --git a/libstdc++-v3/testsuite/25_algorithms/copy/move_iterators/69478.cc b/libstdc++-v3/testsuite/25_algorithms/copy/move_iterators/69478.cc
>index 2d0ff728b8c..84ead4831a6 100644
>--- a/libstdc++-v3/testsuite/25_algorithms/copy/move_iterators/69478.cc
>+++ b/libstdc++-v3/testsuite/25_algorithms/copy/move_iterators/69478.cc
>@@ -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);
>diff --git a/libstdc++-v3/testsuite/25_algorithms/copy_backward/move_iterators/69478.cc b/libstdc++-v3/testsuite/25_algorithms/copy_backward/move_iterators/69478.cc
>index 572eaab8eff..dde85ad8545 100644
>--- a/libstdc++-v3/testsuite/25_algorithms/copy_backward/move_iterators/69478.cc
>+++ b/libstdc++-v3/testsuite/25_algorithms/copy_backward/move_iterators/69478.cc
>@@ -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);
>diff --git a/libstdc++-v3/testsuite/25_algorithms/move/69478.cc b/libstdc++-v3/testsuite/25_algorithms/move/69478.cc
>index 3cad8c8304a..04a369080b1 100644
>--- a/libstdc++-v3/testsuite/25_algorithms/move/69478.cc
>+++ b/libstdc++-v3/testsuite/25_algorithms/move/69478.cc
>@@ -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);
>diff --git a/libstdc++-v3/testsuite/25_algorithms/move_backward/69478.cc b/libstdc++-v3/testsuite/25_algorithms/move_backward/69478.cc
>index 5892f0b38ab..9a88dae4d5e 100644
>--- a/libstdc++-v3/testsuite/25_algorithms/move_backward/69478.cc
>+++ b/libstdc++-v3/testsuite/25_algorithms/move_backward/69478.cc
>@@ -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);
>diff --git a/libstdc++-v3/testsuite/25_algorithms/rotate/constrained.cc b/libstdc++-v3/testsuite/25_algorithms/rotate/constrained.cc
>index 33f2633dfdd..37a47e10b10 100644
>--- a/libstdc++-v3/testsuite/25_algorithms/rotate/constrained.cc
>+++ b/libstdc++-v3/testsuite/25_algorithms/rotate/constrained.cc
>@@ -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,
>diff --git a/libstdc++-v3/testsuite/25_algorithms/rotate_copy/constrained.cc b/libstdc++-v3/testsuite/25_algorithms/rotate_copy/constrained.cc
>index 2907e3bc5b3..85afbe3ea73 100644
>--- a/libstdc++-v3/testsuite/25_algorithms/rotate_copy/constrained.cc
>+++ b/libstdc++-v3/testsuite/25_algorithms/rotate_copy/constrained.cc
>@@ -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,
>-- 
>2.34.1
>





More information about the Libstdc++ mailing list