From: Jonathan Wakely Date: Fri, 31 Jul 2020 16:51:00 +0000 (+0100) Subject: libstdc++: Adjust tests that give different results in C++20 X-Git-Tag: basepoints/gcc-12~5795 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e2592a88821511aa45c3325246f3b08a88fa063;p=thirdparty%2Fgcc.git libstdc++: Adjust tests that give different results in C++20 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. --- diff --git a/libstdc++-v3/testsuite/20_util/is_aggregate/value.cc b/libstdc++-v3/testsuite/20_util/is_aggregate/value.cc index bef9dc4ca074..085eb5574196 100644 --- a/libstdc++-v3/testsuite/20_util/is_aggregate/value.cc +++ b/libstdc++-v3/testsuite/20_util/is_aggregate/value.cc @@ -45,8 +45,6 @@ void test01() UnionType>(true), ""); static_assert(test_category(true), ""); - static_assert(test_category(true), ""); static_assert(test_category(true), ""); static_assert(test_category(true), ""); static_assert(test_category(true), ""); - pos(); +#if __cplusplus == 201703L + static_assert(test_category(true), ""); + pos(); +#endif // Negative tests. static_assert(test_category(false), ""); neg(); +#if __cplusplus > 201703L + // In C++20 aggregates cannot have user-declared constructors. + static_assert(test_category(false), ""); + neg(); +#endif } diff --git a/libstdc++-v3/testsuite/20_util/optional/requirements.cc b/libstdc++-v3/testsuite/20_util/optional/requirements.cc index 560e6f7691f1..d8d52ab53679 100644 --- a/libstdc++-v3/testsuite/20_util/optional/requirements.cc +++ b/libstdc++-v3/testsuite/20_util/optional/requirements.cc @@ -312,7 +312,10 @@ struct JustEq {}; bool operator==(const JustEq&, const JustEq&); static_assert(is_eq_comparable>::value, ""); +#if __cplusplus == 201703L +// In C++20 operator!= can be synthesized from operator== static_assert(!is_neq_comparable>::value, ""); +#endif static_assert(!is_lt_comparable>::value, ""); static_assert(!is_gt_comparable>::value, ""); static_assert(!is_le_comparable>::value, "");