libstdc++: Fix two tests that fail in C++20 mode
authorJonathan Wakely <jwakely@redhat.com>
Sat, 28 Mar 2020 21:52:13 +0000 (21:52 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Sat, 28 Mar 2020 21:52:13 +0000 (21:52 +0000)
* testsuite/20_util/is_constructible/value-2.cc: Fix test to account
for changes due to parenthesized aggregate-initialization in C++20.
* testsuite/20_util/time_point/cons/81468.cc: Fix test to not clash
with std::chrono::sys_time in C++20.

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/20_util/is_constructible/value-2.cc
libstdc++-v3/testsuite/20_util/time_point/cons/81468.cc

index a016f640df35499b407a0b7a658769a8a4418892..912bab28691dbe865d2da0d51965eb72da1e304a 100644 (file)
@@ -1,5 +1,10 @@
 2020-03-28  Jonathan Wakely  <jwakely@redhat.com>
 
+       * testsuite/20_util/is_constructible/value-2.cc: Fix test to account
+       for changes due to parenthesized aggregate-initialization in C++20.
+       * testsuite/20_util/time_point/cons/81468.cc: Fix test to not clash
+       with std::chrono::sys_time in C++20.
+
        * include/bits/stl_iterator.h (reverse_iterator): Use requires-clause
        to constrain C++20 versions of comparison operators. Fix backwards
        logic of relational operators.
index c73cab8c02b7ff9dc6187fee7aa4c02f3139730d..c54b749c0463966a01e5979c03fae01e8cf98792 100644 (file)
@@ -107,7 +107,9 @@ static_assert(!std::is_constructible<Abstract, std::nullptr_t>::value, "Error");
 static_assert(!std::is_constructible<std::nullptr_t, Abstract>::value, "Error");
 static_assert(!std::is_constructible<Abstract, int[]>::value, "Error");
 static_assert(std::is_constructible<B, D>::value, "Error");
+#ifndef __cpp_aggregate_paren_init
 static_assert(!std::is_constructible<D, B>::value, "Error");
+#endif
 static_assert(!std::is_constructible<int[], int[1]>::value, "Error");
 static_assert(!std::is_constructible<int[1], int[]>::value, "Error");
 static_assert(!std::is_constructible<int[], Empty>::value, "Error");
@@ -416,7 +418,9 @@ static_assert(!std::is_constructible<int(&)[1], int(&)[2]>::value, "Error");
 static_assert(!std::is_constructible<int(&)[1], int&>::value, "Error");
 static_assert(!std::is_constructible<int&, int(&)[1]>::value, "Error");
 
+#ifndef __cpp_aggregate_paren_init
 static_assert(!std::is_constructible<U, int>::value, "Error");
+#endif
 static_assert(!std::is_constructible<U, Empty>::value, "Error");
 
 static_assert(!std::is_constructible<void(), void()>::value, "Error");
index 6f3e920d789291f4b1a28d0a4e8fa00d12cd1cad..99ded478d3f4cb984f6e74859772cba2e3d6e557 100644 (file)
 #include <chrono>
 #include <type_traits>
 
-using namespace std;
-using namespace std::chrono;
+using std::is_constructible;
+using std::chrono::seconds;
+using std::chrono::milliseconds;
 
 template <class Duration>
-    using sys_time = time_point<system_clock, Duration>;
+    using sys_time
+      = std::chrono::time_point<std::chrono::system_clock, Duration>;
 
 static_assert(is_constructible<sys_time<milliseconds>, sys_time<seconds>>{},
     "Can construct time_point from one with lower precision duration");