https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100249

--- Comment #5 from 康桓瑋 <hewillk at gmail dot com> ---
(In reply to Patrick Palka from comment #4)
> (In reply to 康桓瑋 from comment #0)
> > when the type of __proj_val is an rvalue reference, we need to convert it to
> > rvalue for the next std::__invoke call: https://godbolt.org/z/1G7aqxs3c.
> 
> So it seems the projection application limit of 3 makes it impossible for
> ranges::clamp to perfectly support the case where the projection returns an
> rvalue reference.

Maybe this can help:

  auto&& __proj_val = std::__invoke(__proj, __val);
      if (std::__invoke(__comp, std::forward<decltype(__proj_val)>(__proj_val),
std::__invoke(__proj, __lo)))
        return __lo;

Reply via email to