Bug 383402

Summary: Generic lambda marked incorrectly as error
Product: [Applications] kdevelop Reporter: Martin Flöser <mgraesslin>
Component: Language Support: CPP (Clang-based)Assignee: kdevelop-bugs-null
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: NOR    
Version: git master   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In:

Description Martin Flöser 2017-08-11 18:13:57 UTC
As of C++14 it is possible to use auto as the type in a lambda parameter. See: https://isocpp.org/wiki/faq/cpp14-language#generic-lambdas

When using this in KDevelop the semantic highlighting reports:
'auto' not allowed as lambda parameter

Furthermore the parameter is then in addition marked as unused parameter.
Comment 1 Kevin Funk 2017-08-11 20:11:38 UTC
Works for me. No errors reported with this code:

auto size = [](const auto& m) { return m.size(); };


Please make sure the internal parser in KDevelop actually is parsing in C++14 mode.

Go to Project -> Open Configuration -> Language Support -> C/C++ Parser -> C++ Profile: Custom. Make sure `-std=c++14` is in the line edit.
Comment 2 Martin Flöser 2017-08-12 09:05:04 UTC
While it's great that there is such a flexibility I have to disagree with your solution of worksforme. I don't think you can expect your users to know that such settings exist (at least I didn't and I spent about 8h a day in kdevelop using it as my IDE at $work plus the spare time hacking on KWin).

The CMakeLists.txt contains
set(CMAKE_CXX_STANDARD 14)

so I would expect that KDevelop picks up the standard set for the project in CMake.