function2 icon indicating copy to clipboard operation
function2 copied to clipboard

Could not construct fu2::unique_function from a pointer to member function on MSVC

Open Serikov opened this issue 2 months ago • 0 comments

Compiling this example in MSVC v19.43 VS17.13 godbolt link gives an error: more than one partial specialization matches the template argument list

Example code:

#include "function2/function2.hpp"
#include <functional>

struct Foo {
  std::size_t bar() const {
    return 5;
  }
};

int main() {
    std::function<std::size_t(const Foo&)> f(&Foo::bar); // compiles
    fu2::unique_function<std::size_t(const Foo&)> f2(&Foo::bar); // gives an error
}

Serikov avatar Dec 12 '25 08:12 Serikov