STL icon indicating copy to clipboard operation
STL copied to clipboard

`<algorithm>`: `ranges::inplace_merge` accidentally constructed `remove_cvref_t<iter_rvalue_reference_t <I>>`

Open hewillk opened this issue 2 years ago • 2 comments

This is basically a sibling of #4102.

https://github.com/microsoft/STL/blob/1c59a205787f4fdcd9c20decc8fa6dfa9096d394/stl/inc/algorithm#L7614-L7630

auto _Temp = _RANGES iter_move(_Mid) unexpectedly constructed remove_cvref_t<iter_reference_t<I>>.

Contrived testcase: https://godbolt.org/z/b7YqKPMej

hewillk avatar Oct 19 '23 16:10 hewillk

It seems that we should use iter_value_t<_It> _Temp(_RANGES iter_move(_First));.

frederick-vs-ja avatar Oct 20 '23 03:10 frederick-vs-ja

Agreed. As in https://github.com/microsoft/STL/issues/4102#issuecomment-1769421279 this also indicates missing test coverage.

StephanTLavavej avatar Oct 25 '23 21:10 StephanTLavavej