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.rich...@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.