#include <functional>
struct A
{
A(int)
{}
};
void f(std::function<void(void*)> fn)
{
A a(0);
fn(&a);
}
int main()
{
int n = 0;
auto fn = [&](void* p)
{
//
// error C2664: 'void f(void (__cdecl *)(void *))' :
// cannot convert parameter 1 from
// 'main::<lambda_b20f735b061d78dbb0f2f653ecbb482f>'
// to 'void (__cdecl *)(void *)'
//
new (p) A(n);
};
f(fn);
}
I2luY2x1ZGUgPGZ1bmN0aW9uYWw+CgpzdHJ1Y3QgQQp7CiAgICBBKGludCkKICAgIHt9Cn07Cgp2b2lkIGYoc3RkOjpmdW5jdGlvbjx2b2lkKHZvaWQqKT4gZm4pCnsKICAgIEEgYSgwKTsKICAgIGZuKCZhKTsKfQoKaW50IG1haW4oKQp7CiAgICBpbnQgbiA9IDA7CiAgICBhdXRvIGZuID0gWyZdKHZvaWQqIHApCiAgICB7CiAgICAgICAgLy8KICAgICAgICAvLyBlcnJvciBDMjY2NDogJ3ZvaWQgZih2b2lkIChfX2NkZWNsICopKHZvaWQgKikpJyA6IAogICAgICAgIC8vIGNhbm5vdCBjb252ZXJ0IHBhcmFtZXRlciAxIGZyb20gCiAgICAgICAgLy8gJ21haW46OjxsYW1iZGFfYjIwZjczNWIwNjFkNzhkYmIwZjJmNjUzZWNiYjQ4MmY+JyAKICAgICAgICAvLyB0byAndm9pZCAoX19jZGVjbCAqKSh2b2lkICopJwogICAgICAgIC8vCiAgICAgICAgbmV3IChwKSBBKG4pOwogICAgfTsKCiAgICBmKGZuKTsKfQo=