Domanda

The compiler at rextester says it's running clang 3.4, and the clang language support page says that clang 3.4 supports generic lambdas, but I can't get this code to compile:

int main()
{
    auto genLambda = [](auto param) {};
}

I'm compiling with -std=c++1y. Compiling with --version results in the following, which is why I believe I'm running clang 3.4:

Ubuntu clang version 3.4-1ubuntu1 (trunk) (based on LLVM 3.4)
Target: x86_64-pc-linux-gnu
Thread model: posix

Any idea what I'm doing wrong?

È stato utile?

Soluzione

Using clang 3.4 on my computer with only --std=c++1y works with your example code.

Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4)

Because your --version references trunk it's probably an SVN copy of clang 3.4 which was obtained prior to generic lambdas being added to the code base.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top