void Dummy(void)
{
}
template
void lambdaTest(LAMBDA lam)
{
auto result = ([](void) { return [](LAMBDA l) -> void { }; })(); // OK
([](LAMBDA l) -> void { l(); })(lam); // OK
([&lam](void) -> void { lam(); })(); // OK
void (*p)(void) = Dummy;
([p](void) { return [p](void) -> void { (*p)(); }; })()(); // OK
([&lam](void) { return [&lam](void) -> void { lam(); }; })(); // ERROR
([](LAMBDA l) { return [&l](void) -> void { l(); }; })(lam); // ERROR
}
int main(void)
{
lambdaTest([](void)->void{});
}
The code above failed to compile under ICC 11.1 with an unkown error (compiling abort) for Mac OS X but compiled successfully under ICC 11.0.061 for Windows XP.
However, the following code can be compiled successfully:
#include
using namespace std;
int main(void)
{
auto lam = [](void) -> void { cout << "I am !" << endl; };
([&lam](void) { return (cout << "I am a high-order function!" << endl,
[&lam](void) -> void { lam(); }); })()();
}
I wonder what has happend with ICC 11.1 about lambda expression.



