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

            Bug ID: 72820
           Summary: std::function can't store types with overloaded
                    operator new
           Product: gcc
           Version: 6.1.1
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

#include <functional>

struct foo {
  void operator()() { }
  static void* operator new(std::size_t, void* p);
};

int main()
{
  std::function<void()> f = foo{};
}

The placement new-expressions in std::function need to use ::new

Reply via email to