[Bug c++/108290] New: QoI: bind_front captureless lambda is too big

lichray at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Jan 4 22:20:42 GMT 2023


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

            Bug ID: 108290
           Summary: QoI: bind_front captureless lambda is too big
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lichray at gmail dot com
  Target Milestone: ---

libstdc++ does not give the following guarantee, while libc++ and MS STL can:

    auto captureless = [](FILE *, void *, size_t) { return 0; };

    static_assert(sizeof(std::bind_front(captureless, stdin)) ==
sizeof(stdin));

See https://godbolt.org/z/TrWP6KohG

The expectation is that some form of EBO is implemented to treat the empty
callable as the base. libc++ did this by laying down all state entities in a
std::tuple. MS STL did this by storing compressed_pair<target,
std::tuple<bound_args>> (so they have this optimization even when their
std::tuple doesn't do EBO).


More information about the Gcc-bugs mailing list