Qt Creator cannot parse lambda with parameter involved with decltype
-
I'm using Qt 5.4.2 and Qt Creator 3.4.1.
I'm found that Qt Creator parse lambda parameter with decltype incorrectly.
for example
this works fine if parameter type without decltypestd::map<std::string, std::string> someMap; std::vector<std::string> targetVector; std::transform(someMap.begin(), someMap.end(), std::back_inserter(targetVector), [](const std::map<std::string, std::string>::value_type &pair) -> const std::string { return pair.first; });
however if I'm using decltype in parameter type
std::map<std::string, std::string> someMap; std::vector<std::string> targetVector; std::transform(someMap.begin(), someMap.end(), std::back_inserter(targetVector), [](const decltype(someMap)::value_type &pair) -> const std::string { return pair.first; });
Qt Creator shows
expected token `;` got `const`
Is this bug or shouldn't I declare parameter in this way?
-
If I understand you correctly, you are getting a compiler error, right? In that case, this has nothing to do with Qt Creator.
Or are you talking about an error in Qt Creator's C++ code model?
-
Also, as a temporary workaround, you can try turning on the Clang code model plugin - maybe it will help you.
-
OK I found that it's unresolved bug related to decltype generally, not limited to lambda case.
https://bugreports.qt.io/browse/QTCREATORBUG-13726
As workaround, I would declare as the wordy type in example to avoid the problem.
I've heard that Clang code model complete is very slow, but I haven't really tried it.Thanks for reply, sierdzio.
BTW, is that I need to register another account for bugreport only? Separate from forum account?
-
@blazar said:
BTW, is that I need to register another account for bugreport only? Separate from forum account?
I'm not sure what is the current status. Previously, you needed separate accounts for pretty much all Qt services (Qt Account, forum account, JIRA account, etc.). The plan is to unify all those logins under a single one (Qt Account). This is already done for the forum, but seemingly the bugtracker is not there yet. If you want to know more, Tero Kojo probably has detailed information, he is one of the admins and is employed by Qt Company to update the various web services, as far as I am aware.