+2015-04-29 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/64657
+ * include/bits/basic_string (basic_string::_S_copy_chars): Cast
+ expression to void.
+ * include/bits/locale_facets_nonio.tcc (money_get::_M_extract,
+ time_get::_M_extract_num, time_get::_M_extract_name,
+ time_get::_M_extract_wday_or_month): Likewise.
+ * include/bits/stl_algo.h (__includes, __replace_copy_if,
+ __is_sorted_until, __is_permutation, transform): Likewise.
+ * include/bits/stl_algobase.h (swap_ranges, __copy_move::__copy_m,
+ __equal::equal, __lexicographical_compare_impl, equal): Likewise.
+ * include/bits/stl_numeric.h (inner_product): Likewise.
+ * include/bits/stl_uninitialized.h (__uninitialized_copy_a): Likewise.
+ * testsuite/util/testsuite_iterators.h (output_iterator_wrapper,
+ input_iterator_wrapper): Declare unusable comma operator.
+ * testsuite/21_strings/basic_string/cons/char/64657.cc: New.
+ * testsuite/21_strings/basic_string/modifiers/assign/char/64657.cc:
+ New.
+
2015-04-28 Doug Evans <dje@google.com>
* testsuite/libstdc++-xmethods/list.cc (_GLIBCXX_USE_CXX11_ABI):
_S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2)
_GLIBCXX_NOEXCEPT
{
- for (; __k1 != __k2; ++__k1, ++__p)
+ for (; __k1 != __k2; ++__k1, (void)++__p)
traits_type::assign(*__p, *__k1); // These types are off.
}
_S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2)
_GLIBCXX_NOEXCEPT
{
- for (; __k1 != __k2; ++__k1, ++__p)
+ for (; __k1 != __k2; ++__k1, (void)++__p)
traits_type::assign(*__p, *__k1); // These types are off.
}
size_type __j = 0;
for (; __beg != __end && __j < __len
&& *__beg == __lc->_M_curr_symbol[__j];
- ++__beg, ++__j);
+ ++__beg, (void)++__j);
if (__j != __len
&& (__j || __io.flags() & ios_base::showbase))
__testvalid = false;
: __lc->_M_positive_sign;
size_type __i = 1;
for (; __beg != __end && __i < __sign_size
- && *__beg == __sign[__i]; ++__beg, ++__i);
+ && *__beg == __sign[__i]; ++__beg, (void)++__i);
if (__i != __sign_size)
__testvalid = false;
++__min;
size_t __i = 0;
int __value = 0;
- for (; __beg != __end && __i < __len; ++__beg, ++__i)
+ for (; __beg != __end && __i < __len; ++__beg, (void)++__i)
{
const char __c = __ctype.narrow(*__beg, '*');
if (__c >= '0' && __c <= '9')
for (size_t __i2 = 1; __i2 < __nmatches; ++__i2)
__minlen = std::min(__minlen,
__traits_type::length(__names[__matches[__i2]]));
- ++__beg, ++__pos;
+ ++__beg;
+ ++__pos;
if (__pos < __minlen && __beg != __end)
for (size_t __i3 = 0; __i3 < __nmatches;)
{
if (__nmatches == 1)
{
// Make sure found name is completely extracted.
- ++__beg, ++__pos;
+ ++__beg;
+ ++__pos;
__name = __names[__matches[0]];
const size_t __len = __traits_type::length(__name);
while (__pos < __len && __beg != __end && __name[__pos] == *__beg)
- ++__beg, ++__pos;
+ ++__beg, (void)++__pos;
if (__len == __pos)
__member = __matches[0];
if (__nmatches)
{
- ++__beg, ++__pos;
+ ++__beg;
+ ++__pos;
__matches_lengths
= static_cast<size_t*>(__builtin_alloca(sizeof(size_t)
= __traits_type::length(__names[__matches[__i]]);
}
- for (; __beg != __end; ++__beg, ++__pos)
+ for (; __beg != __end; ++__beg, (void)++__pos)
{
size_t __nskipped = 0;
const char_type __c = *__beg;
else if (__comp(__first1, __first2))
++__first1;
else
- ++__first1, ++__first2;
+ {
+ ++__first1;
+ ++__first2;
+ }
return __first2 == __last2;
}
_OutputIterator __result,
_Predicate __pred, const _Tp& __new_value)
{
- for (; __first != __last; ++__first, ++__result)
+ for (; __first != __last; ++__first, (void)++__result)
if (__pred(__first))
*__result = __new_value;
else
return __last;
_ForwardIterator __next = __first;
- for (++__next; __next != __last; __first = __next, ++__next)
+ for (++__next; __next != __last; __first = __next, (void)++__next)
if (__comp(__next, __first))
return __next;
return __next;
{
// Efficiently compare identical prefixes: O(N) if sequences
// have the same elements in the same order.
- for (; __first1 != __last1; ++__first1, ++__first2)
+ for (; __first1 != __last1; ++__first1, (void)++__first2)
if (!__pred(__first1, __first2))
break;
// Efficiently compare identical prefixes: O(N) if sequences
// have the same elements in the same order.
for (; __first1 != __last1 && __first2 != __last2;
- ++__first1, ++__first2)
+ ++__first1, (void)++__first2)
if (!__pred(__first1, __first2))
break;
__typeof__(__unary_op(*__first))>)
__glibcxx_requires_valid_range(__first, __last);
- for (; __first != __last; ++__first, ++__result)
+ for (; __first != __last; ++__first, (void)++__result)
*__result = __unary_op(*__first);
return __result;
}
__typeof__(__binary_op(*__first1,*__first2))>)
__glibcxx_requires_valid_range(__first1, __last1);
- for (; __first1 != __last1; ++__first1, ++__first2, ++__result)
+ for (; __first1 != __last1; ++__first1, (void)++__first2, ++__result)
*__result = __binary_op(*__first1, *__first2);
return __result;
}
_ForwardIterator2>)
__glibcxx_requires_valid_range(__first1, __last1);
- for (; __first1 != __last1; ++__first1, ++__first2)
+ for (; __first1 != __last1; ++__first1, (void)++__first2)
std::iter_swap(__first1, __first2);
return __first2;
}
static _OI
__copy_m(_II __first, _II __last, _OI __result)
{
- for (; __first != __last; ++__result, ++__first)
+ for (; __first != __last; ++__result, (void)++__first)
*__result = *__first;
return __result;
}
static _OI
__copy_m(_II __first, _II __last, _OI __result)
{
- for (; __first != __last; ++__result, ++__first)
+ for (; __first != __last; ++__result, (void)++__first)
*__result = std::move(*__first);
return __result;
}
static bool
equal(_II1 __first1, _II1 __last1, _II2 __first2)
{
- for (; __first1 != __last1; ++__first1, ++__first2)
+ for (; __first1 != __last1; ++__first1, (void)++__first2)
if (!(*__first1 == *__first2))
return false;
return true;
__last1 = __rai_type::__newlast1(__first1, __last1, __first2, __last2);
for (; __first1 != __last1 && __rai_type::__cnd2(__first2, __last2);
- ++__first1, ++__first2)
+ ++__first1, (void)++__first2)
{
if (__comp(__first1, __first2))
return true;
__glibcxx_function_requires(_InputIteratorConcept<_IIter2>)
__glibcxx_requires_valid_range(__first1, __last1);
- for (; __first1 != __last1; ++__first1, ++__first2)
+ for (; __first1 != __last1; ++__first1, (void)++__first2)
if (!bool(__binary_pred(*__first1, *__first2)))
return false;
return true;
return _GLIBCXX_STD_A::equal(__first1, __last1, __first2);
}
- for (; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
+ for (; __first1 != __last1 && __first2 != __last2;
+ ++__first1, (void)++__first2)
if (!(*__first1 == *__first2))
return false;
return __first1 == __last1 && __first2 == __last2;
__binary_pred);
}
- for (; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
+ for (; __first1 != __last1 && __first2 != __last2;
+ ++__first1, (void)++__first2)
if (!bool(__binary_pred(*__first1, *__first2)))
return false;
return __first1 == __last1 && __first2 == __last2;
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
__glibcxx_requires_valid_range(__first1, __last1);
- for (; __first1 != __last1; ++__first1, ++__first2)
+ for (; __first1 != __last1; ++__first1, (void)++__first2)
__init = __init + (*__first1 * *__first2);
return __init;
}
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
__glibcxx_requires_valid_range(__first1, __last1);
- for (; __first1 != __last1; ++__first1, ++__first2)
+ for (; __first1 != __last1; ++__first1, (void)++__first2)
__init = __binary_op1(__init, __binary_op2(*__first1, *__first2));
return __init;
}
__try
{
typedef __gnu_cxx::__alloc_traits<_Allocator> __traits;
- for (; __first != __last; ++__first, ++__cur)
+ for (; __first != __last; ++__first, (void)++__cur)
__traits::construct(__alloc, std::__addressof(*__cur), *__first);
return __cur;
}
--- /dev/null
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+
+#include <string>
+#include <testsuite_iterators.h>
+
+void
+test01()
+{
+ using namespace __gnu_test;
+ char* p = 0;
+ test_container<char, forward_iterator_wrapper> c(p, p);
+ std::string s(c.begin(), c.end());
+}
--- /dev/null
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+
+#include <string>
+#include <testsuite_iterators.h>
+
+void
+test01()
+{
+ using namespace __gnu_test;
+ char* p = 0;
+ test_container<char, forward_iterator_wrapper> c(p, p);
+ std::string s;
+ s.assign(c.begin(), c.end());
+}
return tmp;
}
+#if __cplusplus >= 201103L
+ template<typename U>
+ void operator,(const U&) const = delete;
+#else
+ private:
+ template<typename U>
+ void operator,(const U&) const;
+#endif
};
/**
{
++*this;
}
+
+#if __cplusplus >= 201103L
+ template<typename U>
+ void operator,(const U&) const = delete;
+#else
+ private:
+ template<typename U>
+ void operator,(const U&) const;
+#endif
};
++*this;
return tmp;
}
- };
+ };
/**
* @brief bidirectional_iterator wrapper for pointer
--*this;
return tmp;
}
- };
+ };
/**
* @brief random_access_iterator wrapper for pointer
{
return !(*this > in);
}
- };
+ };
template<typename T>
random_access_iterator_wrapper<T>