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

            Bug ID: 111963
           Summary: Predicate copied when it could be forwarded in some
                    STL algorithms
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chgros at synopsys dot com
  Target Milestone: ---

Not exactly a bug, since copying a predicate is explicitly allowed, but I have
a checker that detects copies that could be replaced with moves, and it
reported in the STL headers, notably (in std::partition in stl_algo.h line
4632)
      return std::__partition(__first, __last, __pred,
                              std::__iterator_category(__first));
Here it complained that __pred was copied when it could be moved (though that's
also true of the iterators). I think it would make sense to forward arguments
to tail calls, though I'll admit that in practice it should make little
difference; I understand if you think it's not worth your time to change.

Reply via email to