简体   繁体   中英

How get clang 3.4 to compile generic lambdas?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM