public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/106871] New: std::function should not check func ptr on each call
@ 2022-09-07 11:55 rockeet at gmail dot com
2022-09-07 11:59 ` [Bug libstdc++/106871] " redi at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: rockeet at gmail dot com @ 2022-09-07 11:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106871
Bug ID: 106871
Summary: std::function should not check func ptr on each call
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: rockeet at gmail dot com
Target Milestone: ---
std::function should not check func ptr on each call, an optimization should
be:
define a 'default throw' function which just throws a std::bad_function_call.
in std::function constructor, set the function ptr to this 'default throw'
function. (assign nullptr also set this 'default throw' to std::function).
in this way, it is not needed to check the function ptr in each std::function
call. and the nullptr check can use any other 2 ptr-width fields of
std::function.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug libstdc++/106871] std::function should not check func ptr on each call
2022-09-07 11:55 [Bug libstdc++/106871] New: std::function should not check func ptr on each call rockeet at gmail dot com
@ 2022-09-07 11:59 ` redi at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2022-09-07 11:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106871
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I've looked into this and I don't think it can be done without an ABI break.
Objects constructed in old code compiled by an older GCC would still have a
null pointer, so code compiled by a new GCC can't assume that the pointer is
never null.
We have another PR on the same subject anyway.
*** This bug has been marked as a duplicate of bug 56551 ***
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-07 11:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-07 11:55 [Bug libstdc++/106871] New: std::function should not check func ptr on each call rockeet at gmail dot com
2022-09-07 11:59 ` [Bug libstdc++/106871] " 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).