Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions stl/inc/algorithm
Original file line number Diff line number Diff line change
Expand Up @@ -7781,7 +7781,7 @@ namespace ranges {
void _Rotate_one_right(_It _First, _It _Mid, _It _Last) {
// exchanges the range [_First, _Mid) with [_Mid, _Last)
_STL_INTERNAL_CHECK(_RANGES next(_Mid) == _Last);
auto _Temp = _RANGES iter_move(_Mid);
iter_value_t<_It> _Temp(_RANGES iter_move(_Mid));
_RANGES _Move_backward_common(_First, _STD move(_Mid), _STD move(_Last));
*_First = _STD move(_Temp);
}
Expand All @@ -7790,7 +7790,7 @@ namespace ranges {
void _Rotate_one_left(_It _First, _It _Mid, _It _Last) {
// exchanges the range [_First, _Mid) with [_Mid, _Last)
_STL_INTERNAL_CHECK(_RANGES next(_First) == _Mid);
auto _Temp = _RANGES iter_move(_First);
iter_value_t<_It> _Temp(_RANGES iter_move(_First));
auto _Result = _RANGES _Move_unchecked(_STD move(_Mid), _STD move(_Last), _STD move(_First));
*_Result.out = _STD move(_Temp);
}
Expand Down Expand Up @@ -10286,7 +10286,7 @@ namespace ranges {
}

while (++_UFirst != _ULast) { // process one or two elements
auto _Prev = *_UFirst;
_Vty _Prev(*_UFirst);
if (++_UFirst == _ULast) { // process last element
if (_STD invoke(_Pred, _STD invoke(_Proj, _Prev), _STD invoke(_Proj, _Found.min))) {
_Found.min = _STD move(_Prev);
Expand Down
1 change: 1 addition & 0 deletions tests/std/test.lst
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ tests\GH_003840_tellg_when_reading_lf_file_in_text_mode
tests\GH_003867_output_nan
tests\GH_004023_mdspan_fwd_prod_overflow
tests\GH_004040_container_nonmember_functions
tests\GH_004108_some_ranges_algos_construct_wrong_type
tests\GH_004109_iter_value_t_direct_initialization
tests\GH_004129_conversion_in_new_numeric_algorithms
tests\GH_004201_chrono_formatter
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

RUNALL_INCLUDE ..\usual_20_matrix.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include <algorithm>
#include <cstddef>
#include <ranges>

using namespace std;

namespace gh4108 {
struct RRef {
RRef(RRef&&) = delete;
};

struct Val {
Val(const RRef&);
auto operator<=>(const Val&) const = default;
};

struct I {
using value_type = Val;
using difference_type = ptrdiff_t;
Val& operator*() const;
I& operator++();
I operator++(int);
I& operator--();
I operator--(int);
bool operator==(const I&) const;
friend RRef&& iter_move(const I&);
};

// GH-4108 <algorithm>: ranges::inplace_merge accidentally constructed remove_cvref_t<iter_rvalue_reference_t<I>>
void test_gh_4108() {
ranges::inplace_merge(I{}, I{}, I{});
}
} // namespace gh4108

namespace gh4102 {
struct Ref {
Ref(const Ref&) = delete;
auto operator<=>(const Ref&) const = default;
};

struct Val {
Val() = default;
Val(const Ref&);
auto operator<=>(const Val&) const = default;
};

struct I {
using value_type = Val;
using difference_type = ptrdiff_t;
const Ref& operator*() const;
I& operator++();
void operator++(int);
bool operator==(const I&) const;
};

// GH-4102 <algorithm>: ranges::minmax accidentally constructed remove_cvref_t<iter_reference_t<I>>
void test_gh_4102() {
[[maybe_unused]] auto result = ranges::minmax(ranges::subrange<I, I>{});
}
} // namespace gh4102