1

I have a problem with lambdas in MSVC2010.

It is successful compiled:

auto f1 = []() { };
boost::function<void()> a = f1;

But it brings an error C2440:

auto f2 = []()
{
    auto f3 = []() { };
    boost::function<void()> b = f3;
};

Error C2440:

'initializing' : cannot convert from 'int' to 'boost::function<Signature>'
    with
    [
        Signature=void (void)
    ]
    No constructor could take the source type, or constructor overload resolution was ambiguous

Why? Does it work in GCC4.6?

4

1 回答 1

0

可能是 MSVC 中的一个错误(错误消息似乎非常可疑)。它适用于 GCC 4.7。

于 2012-04-20T11:17:41.780 回答