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

            Bug ID: 111327
           Summary: std::bind_front doesn't perfectly forward according to
                    value category of the call wrapper object
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppalka at gcc dot gnu.org
  Target Milestone: ---

Testcase:

#include <functional>

struct F {
  void operator()() & = delete; // #1
  void operator()() const &;    // #2
};

int main() {
  auto f = F{};
  auto g = std::bind_front(F{});
  f(); // error: use of deleted function
  g(); // incorrectly calls #2 instead of being ill-formed
}

Since f isn't invocable as a non-const lvalue, g shouldn't be either.

Reply via email to