CLion 2017.1 Generic Lambdas

I understand that functionality for generic lambdas was introduced in version 2017.1 and higher. 

I'm using 2017.1 and I still get error notices for generic lambdas. How can I correct this?

Thanks

0
3 comments

Could you please share an example so we could reproduce the issue on our side?

0

Very simple example on the screen shot below. Compiler should be gcc-4.8.

 

0

Hallo Pwengerd,

Please share your complete source, including CMakeLists.txt, as it works for me for c++14 with 2017.2 release.

CLion IDE Info:

CLion 2017.2
Build #CL-172.3317.49, built on July 11, 2017
JRE: 1.8.0_152-release-915-b5 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.4.0-83-generic

Source files:

cmake_minimum_required(VERSION 3.8)
project(CppTest3)

set(CMAKE_CXX_STANDARD 14)
set(SOURCE_FILES main.cpp)
add_executable(CppTest3 ${SOURCE_FILES})


#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

auto glambda1 = [](auto a) { return a; };
auto glambda2 = [](const auto& x, const auto& y){ return x + y; };
auto glambda3 = [](auto x, const auto& y){ return x + y; };


struct /* anonymous */
{
template <typename T1, typename T2>
auto operator()(const T1& x, const T2& y) const // N3386 Return type deduction
{ return x + y; }
} obS1;

int main() {

cout<<glambda1(1)<<endl;
cout<<glambda2(3, 7)<<endl;
cout<<glambda3(11, 13)<<endl;
cout<<obS1.operator()(25, 25)<<endl;

std::cout << "Hello, World!" << std::endl;
return 0;
}

CppTest3/cmake-build-debug/CppTest3
1
10
24
50
Hello, World!

Process finished with exit code 0

Cheers,
infojg9
0

Please sign in to leave a comment.