https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100795
--- Comment #2 from 康桓瑋 <hewillk at gmail dot com> --- ranges::inplace_merge has the same issue: #include <algorithm> #include <array> #include <ranges> int main() { std::array a{42, 42, 42}; auto r = std::views::iota(0, 3) | std::views::transform([&a](int i) -> int& { return a[i]; }); std::ranges::inplace_merge(r, r.begin()); } https://godbolt.org/z/q6jbxGMjd