From: Jonathan Wakely Date: Tue, 24 Sep 2019 10:09:18 +0000 (+0100) Subject: PR libstdc++/91871 fix Clang warnings in testsuite X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=47d17f705826669e7a7c56f1bee54b4231870e41;p=gcc.git PR libstdc++/91871 fix Clang warnings in testsuite 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 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 54fe95f1ac9..64f8618fc45 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2019-09-24 Jonathan Wakely + + 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 PR libstdc++/91788 (partial) diff --git a/libstdc++-v3/testsuite/util/testsuite_hooks.h b/libstdc++-v3/testsuite/util/testsuite_hooks.h index 51c431bf9c0..84a44faa710 100644 --- a/libstdc++-v3/testsuite/util/testsuite_hooks.h +++ b/libstdc++-v3/testsuite/util/testsuite_hooks.h @@ -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 } };