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; };
Is it still not supported by gcc 4.9? Or I miss some parameters?
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