]> gcc.gnu.org Git - gcc.git/commitdiff
libstdc++: Adjust tests that give different results in C++20
authorJonathan Wakely <jwakely@redhat.com>
Fri, 31 Jul 2020 16:51:00 +0000 (17:51 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 29 Mar 2021 19:58:50 +0000 (20:58 +0100)
libstdc++-v3/ChangeLog:

* testsuite/20_util/is_aggregate/value.cc: Adjust for changes to
definition of aggregates in C++20.
* testsuite/20_util/optional/requirements.cc: Adjust for
defaulted comparisons in C++20.

(cherry picked from commit 8e2592a88821511aa45c3325246f3b08a88fa063)

libstdc++-v3/testsuite/20_util/is_aggregate/value.cc
libstdc++-v3/testsuite/20_util/optional/requirements.cc

index bef9dc4ca074f6546beb6981e92fc5d0b6624acf..085eb55741961ab752e5a711d9a57a55d012e3b8 100644 (file)
@@ -45,8 +45,6 @@ void test01()
                UnionType>(true), "");
   static_assert(test_category<is_aggregate,
                SLType>(true), "");
-  static_assert(test_category<is_aggregate,
-               NoexceptMoveAssignClass>(true), "");
   static_assert(test_category<is_aggregate,
                unsigned[3]>(true), "");
   static_assert(test_category<is_aggregate,
@@ -63,8 +61,13 @@ void test01()
                EnumType[]>(true), "");
   static_assert(test_category<is_aggregate,
                EnumType[][2]>(true), "");
-  pos<ClassType, UnionType, SLType, NoexceptMoveAssignClass,
+  pos<ClassType, UnionType, SLType,
       unsigned[3], unsigned[3][2], unsigned[], unsigned[][3]>();
+#if __cplusplus == 201703L
+  static_assert(test_category<is_aggregate,
+               NoexceptMoveAssignClass>(true), "");
+  pos<NoexceptMoveAssignClass>();
+#endif
 
   // Negative tests.
   static_assert(test_category<is_aggregate,
@@ -93,4 +96,10 @@ void test01()
                void>(false), "");
   neg<AbstractClass, PolymorphicClass, ExplicitClass, char, unsigned,
       bool, float, double, void>();
+#if __cplusplus > 201703L
+  // In C++20 aggregates cannot have user-declared constructors.
+  static_assert(test_category<is_aggregate,
+               NoexceptMoveAssignClass>(false), "");
+  neg<NoexceptMoveAssignClass>();
+#endif
 }
index 560e6f7691f1cc6ce1a2f5a0c65f3e91a0f55610..d8d52ab536790b9ac9ae0d453ef400b7987efdc5 100644 (file)
@@ -312,7 +312,10 @@ struct JustEq {};
 bool operator==(const JustEq&, const JustEq&);
 
 static_assert(is_eq_comparable<optional<JustEq>>::value, "");
+#if __cplusplus == 201703L
+// In C++20 operator!= can be synthesized from operator==
 static_assert(!is_neq_comparable<optional<JustEq>>::value, "");
+#endif
 static_assert(!is_lt_comparable<optional<JustEq>>::value, "");
 static_assert(!is_gt_comparable<optional<JustEq>>::value, "");
 static_assert(!is_le_comparable<optional<JustEq>>::value, "");
This page took 0.062294 seconds and 5 git commands to generate.