@@ -320,7 +320,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* [__first1,__last1-(__last2-__first2))
*/
template<typename _ForwardIterator1, typename _ForwardIterator2>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator1
find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2)
@@ -370,7 +370,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator1
find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2,
@@ -405,7 +405,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @p [__first,__last), and false otherwise.
*/
template<typename _InputIterator, typename _Predicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
{ return __last == std::find_if_not(__first, __last, __pred); }
@@ -423,7 +423,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @p [__first,__last), and false otherwise.
*/
template<typename _InputIterator, typename _Predicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
none_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
{ return __last == _GLIBCXX_STD_A::find_if(__first, __last, __pred); }
@@ -442,7 +442,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* otherwise.
*/
template<typename _InputIterator, typename _Predicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
{ return !std::none_of(__first, __last, __pred); }
@@ -458,7 +458,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* such that @p __pred(*i) is false, or @p __last if no such iterator exists.
*/
template<typename _InputIterator, typename _Predicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _InputIterator
find_if_not(_InputIterator __first, _InputIterator __last,
_Predicate __pred)
@@ -483,7 +483,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* do not.
*/
template<typename _InputIterator, typename _Predicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
is_partitioned(_InputIterator __first, _InputIterator __last,
_Predicate __pred)
@@ -505,7 +505,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* and @p none_of(mid, __last, __pred) are both true.
*/
template<typename _ForwardIterator, typename _Predicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
_ForwardIterator
partition_point(_ForwardIterator __first, _ForwardIterator __last,
_Predicate __pred)
@@ -572,7 +572,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* are copied is unchanged.
*/
template<typename _InputIterator, typename _OutputIterator, typename _Tp>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _OutputIterator
remove_copy(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, const _Tp& __value)
@@ -606,7 +606,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
template<typename _InputIterator, typename _OutputIterator,
typename _Predicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _OutputIterator
remove_copy_if(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _Predicate __pred)
@@ -783,7 +783,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* are still present, but their value is unspecified.
*/
template<typename _ForwardIterator, typename _Tp>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
remove(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __value)
@@ -817,7 +817,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* are still present, but their value is unspecified.
*/
template<typename _ForwardIterator, typename _Predicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
remove_if(_ForwardIterator __first, _ForwardIterator __last,
_Predicate __pred)
@@ -886,7 +886,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* are still present, but their value is unspecified.
*/
template<typename _ForwardIterator>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
unique(_ForwardIterator __first, _ForwardIterator __last)
{
@@ -917,7 +917,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* are still present, but their value is unspecified.
*/
template<typename _ForwardIterator, typename _BinaryPredicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
unique(_ForwardIterator __first, _ForwardIterator __last,
_BinaryPredicate __binary_pred)
@@ -4019,7 +4019,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* for which @c *i == @p __value
*/
template<typename _InputIterator, typename _Tp>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline typename iterator_traits<_InputIterator>::difference_type
count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
{
@@ -4043,7 +4043,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* for which @p __pred(*i) is true.
*/
template<typename _InputIterator, typename _Predicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline typename iterator_traits<_InputIterator>::difference_type
count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
{
@@ -4118,7 +4118,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* equal to @p __val.
*/
template<typename _ForwardIterator, typename _Integer, typename _Tp>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
search_n(_ForwardIterator __first, _ForwardIterator __last,
_Integer __count, const _Tp& __val)
@@ -4407,7 +4407,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
// DR 538. 241 again: Does unique_copy() require CopyConstructible and
// Assignable?
template<typename _InputIterator, typename _OutputIterator>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _OutputIterator
unique_copy(_InputIterator __first, _InputIterator __last,
_OutputIterator __result)
@@ -4448,7 +4448,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
// DR 241. Does unique_copy() require CopyConstructible and Assignable?
template<typename _InputIterator, typename _OutputIterator,
typename _BinaryPredicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _OutputIterator
unique_copy(_InputIterator __first, _InputIterator __last,
_OutputIterator __result,
@@ -27,5 +27,6 @@ int main()
using namespace std;
list<int> menge;
unique (menge.begin(), menge.end());
+ // { dg-warning "ignoring return value" "" { target c++17 } 29 }
return 0;
}
@@ -31,7 +31,7 @@ bool compare(int a, int b)
// libstdc++/11480
void test01()
{
- std::unique(a, a+10, compare);
+ std::unique(a, a+10, compare); // { dg-warning "ignoring return value" "" { target c++17 } }
VERIFY( compare_count == 9 );
}
@@ -35,10 +35,12 @@ void test01()
no_assign in[4];
std::unique_copy(in, in + 4, std::ostream_iterator<int>(oss1, "\n"));
+ // { dg-warning "ignoring return value" "" { target c++17 } 37 }
VERIFY( oss1.str() == "23\n" );
std::unique_copy(in, in + 4, std::ostream_iterator<int>(oss2, "\n"),
std::equal_to<int>());
+ // { dg-warning "ignoring return value" "" { target c++17 } 41 }
VERIFY( oss2.str() == "23\n" );
}