public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/111963] New: Predicate copied when it could be forwarded in some STL algorithms
@ 2023-10-24 17:12 chgros at synopsys dot com
2023-10-24 19:19 ` [Bug libstdc++/111963] " redi at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: chgros at synopsys dot com @ 2023-10-24 17:12 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug libstdc++/111963] Predicate copied when it could be forwarded in some STL algorithms
2023-10-24 17:12 [Bug libstdc++/111963] New: Predicate copied when it could be forwarded in some STL algorithms chgros at synopsys dot com
@ 2023-10-24 19:19 ` redi at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2023-10-24 19:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111963
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The internal functions like __partition could just take forwarding references
to the predicates, at least for C++11 and later.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-24 19:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-24 17:12 [Bug libstdc++/111963] New: Predicate copied when it could be forwarded in some STL algorithms chgros at synopsys dot com
2023-10-24 19:19 ` [Bug libstdc++/111963] " redi at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).