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

            Bug ID: 122022
           Summary: bind_front/bind_back/not_fn pass function parameters
                    by value
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

#include <functional>
#include <cassert>

struct Obj {
  Obj() = default;
  Obj(const Obj&) { assert(0); }
};

struct Fun {
  bool operator()(const Obj&) const { return true; }
};

int main() {
  Obj obj;
  std::bind_front<Fun{}>()(obj); // SIGSEGV
  std::not_fn    <Fun{}>()(obj); // SIGSEGV
}

https://godbolt.org/z/KnrnYErGY

Reply via email to