Bug 383402 - Generic lambda marked incorrectly as error
Summary: Generic lambda marked incorrectly as error
Status: RESOLVED WORKSFORME
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (Clang-based) (show other bugs)
Version: git master
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-11 18:13 UTC by Martin Flöser
Modified: 2017-08-12 09:05 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.