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
This commit is contained in:
Jonathan Wakely 2019-09-24 11:09:18 +01:00 committed by Jonathan Wakely
parent 18b86eda6f
commit 47d17f7058
2 changed files with 14 additions and 4 deletions

View 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)

View 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
}
};