mirror of git://gcc.gnu.org/git/gcc.git
libstdc++/ranges: Fix more wrong value type init from reference type [PR111861]
As in r16-3912-g412a1f78b53709, this fixes some other spots where we wrongly use a deduced type and non-direct-initialization when trying to initialize a value type from an iterator's reference type. PR libstdc++/111861 libstdc++-v3/ChangeLog: * include/bits/ranges_algo.h (ranges::unique_copy): When initializing a value type object from *iter, use direct-initialization and don't use a deduced type. (ranges::push_heap): Use direct-initialization when initializing a value type object from ranges::iter_move. (ranges::max): As in ranges::unique_copy. * include/bits/ranges_util.h (ranges::min): Likewise. Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
This commit is contained in:
parent
9a68895fee
commit
3268c47c08
|
@ -1529,7 +1529,7 @@ namespace ranges
|
|||
}
|
||||
else // indirectly_copyable_storable<_Iter, _Out>
|
||||
{
|
||||
auto __value = *__first;
|
||||
iter_value_t<_Iter> __value(*__first);
|
||||
*__result = __value;
|
||||
while (++__first != __last)
|
||||
{
|
||||
|
@ -2075,9 +2075,9 @@ namespace ranges
|
|||
else
|
||||
{
|
||||
auto __comp_proj = __detail::__make_comp_proj(__comp, __proj);
|
||||
iter_value_t<_Iter> __value(ranges::iter_move(ranges::prev(__last)));
|
||||
__detail::__push_heap(__first, (__last - __first) - 1,
|
||||
0, ranges::iter_move(ranges::prev(__last)),
|
||||
__comp_proj);
|
||||
0, std::move(__value), __comp_proj);
|
||||
return __last;
|
||||
}
|
||||
}
|
||||
|
@ -4219,7 +4219,7 @@ namespace ranges
|
|||
auto __first = ranges::begin(__r);
|
||||
auto __last = ranges::end(__r);
|
||||
__glibcxx_assert(__first != __last);
|
||||
auto __result = *__first;
|
||||
range_value_t<_Range> __result(*__first);
|
||||
while (++__first != __last)
|
||||
{
|
||||
auto&& __tmp = *__first;
|
||||
|
|
|
@ -761,7 +761,7 @@ namespace ranges
|
|||
auto __first = ranges::begin(__r);
|
||||
auto __last = ranges::end(__r);
|
||||
__glibcxx_assert(__first != __last);
|
||||
auto __result = *__first;
|
||||
range_value_t<_Range> __result(*__first);
|
||||
while (++__first != __last)
|
||||
{
|
||||
auto&& __tmp = *__first;
|
||||
|
|
Loading…
Reference in New Issue