gcc 4.9 generic lambdas

516 Views Asked by At

There said https://gcc.gnu.org/projects/cxx1y.html, that generic lambdas supported since gcc 4.9.

But I tried following:

#include <iostream>

auto Identity = [](auto a) { return a; };

int main()
{
    std::cout << Identity(5) << std::endl;
}

And got error (-std=c++1y):

main.cpp:3:25: error: parameter declared 'auto'

 auto Identity = [](auto a) { return a; };

http://goo.gl/Omn8EA

Is it still not supported by gcc 4.9? Or I miss some parameters?

1

There are 1 best solutions below

0
On BEST ANSWER

It is because you're using the pre-release gcc 4.9 experimental, change to the released gcc 4.9 and it compiles fine. Demo