https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100249
--- Comment #9 from Patrick Palka <ppalka at gcc dot gnu.org> --- (In reply to 康桓瑋 from comment #8) > (In reply to Patrick Palka from comment #6) > > > 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; > > > > We could safely forward __proj_val only in the second invocation of __comp, > > after which __proj_val is no longer used, but I'm not sure that's > > worthwhile... > > I specifically asked the forum for this, Tim Song replied that both forwards > are safe, you can see more details in > https://stackoverflow.com/a/67348274/11638718. > Sorry to reply so late. Thanks for looking into this!