public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/107784] New: QOI: sizeof( bind_front( Member-Function ) ) too big
@ 2022-11-21  8:42 joerg.richter@pdv-fs.de
  2022-11-21  8:48 ` [Bug libstdc++/107784] " pinskia at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: joerg.richter@pdv-fs.de @ 2022-11-21  8:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107784
           Summary: QOI: sizeof( bind_front( Member-Function ) ) too big
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: joerg.richter@pdv-fs.de
  Target Milestone: ---

Consider this example:

----8<----
cat > t.cc <<EOF
#include <iostream>
#include <functional>

struct Foo
{
  void func()
  {}
};

int main()
{
  std::cout << sizeof( &Foo::func ) << std::endl;
  std::cout << sizeof( std::bind_front( &Foo::func ) ) << std::endl;
}
EOF

g++ -v
g++ -std=c++20 -o t t.cc
t
----8<----
Outputs 16 and 24.

sizeof(Memberfunction) is 16.
sizeof(bind_front(Memberfunction)) is 24.

The resulting functor is too big to be stored inline in a std::function. It
would be nice if the trival case of bind_front is as big as the native
member-function-pointer.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-01-05 11:34 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-21  8:42 [Bug libstdc++/107784] New: QOI: sizeof( bind_front( Member-Function ) ) too big joerg.richter@pdv-fs.de
2022-11-21  8:48 ` [Bug libstdc++/107784] " pinskia at gcc dot gnu.org
2022-11-21  8:55 ` joerg.richter@pdv-fs.de
2022-11-21 10:39 ` redi at gcc dot gnu.org
2022-11-21 10:41 ` redi at gcc dot gnu.org
2022-11-21 11:02 ` redi at gcc dot gnu.org
2022-11-21 12:10 ` joerg.richter@pdv-fs.de
2022-11-21 12:23 ` redi at gcc dot gnu.org
2022-11-21 17:32 ` redi at gcc dot gnu.org
2022-11-22 14:08 ` joerg.richter@pdv-fs.de
2022-11-22 16:37 ` redi at gcc dot gnu.org
2023-01-05 11:34 ` 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).