PR libstdc++/91871 fix Clang warnings in testsuite
authorJonathan Wakely <jwakely@redhat.com>
Tue, 24 Sep 2019 10:09:18 +0000 (11:09 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 24 Sep 2019 10:09:18 +0000 (11:09 +0100)
PR libstdc++/91871
* testsuite/util/testsuite_hooks.h
(conversion::iterator_to_const_iterator()): Do not return an invalid
iterator. Test direct-initialization and direct-list-initialization
as well as implicit conversion.

From-SVN: r276091

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/util/testsuite_hooks.h

index 54fe95f1ac965e02ff4c72c0e5d37897d9b504f1..64f8618fc45a9cec53f95b2abd6a64c889c737a8 100644 (file)
@@ -1,3 +1,11 @@
+2019-09-24  Jonathan Wakely  <jwakely@redhat.com>
+
+       PR libstdc++/91871
+       * testsuite/util/testsuite_hooks.h
+       (conversion::iterator_to_const_iterator()): Do not return an invalid
+       iterator. Test direct-initialization and direct-list-initialization
+       as well as implicit conversion.
+
 2019-09-23  Jonathan Wakely  <jwakely@redhat.com>
 
        PR libstdc++/91788 (partial)
index 51c431bf9c00de5af7d286cfd280ac83fc722f6b..84a44faa71031c1c4d7d77f42e455ea9268bea25 100644 (file)
@@ -326,13 +326,15 @@ namespace __gnu_test
       typedef typename _Container::const_iterator const_iterator;
 
       // Implicit conversion iterator to const_iterator.
-      static const_iterator
+      static void
       iterator_to_const_iterator()
       {
        _Container v;
-       const_iterator it = v.begin();
-       const_iterator end = v.end();
-       return it == end ? v.end() : it;
+       const_iterator i __attribute__((unused)) = const_iterator(v.begin());
+       const_iterator j __attribute__((unused)) = true ? i : v.begin();
+#if __cplusplus >= 201103L
+       const_iterator k __attribute__((unused)) { v.begin() };
+#endif
       }
     };