Bug 250996

Summary: KDevelop parser has problems with instantiated function templates as arguments?
Product: [Applications] kdevelop Reporter: Alexander <ashaduri>
Component: Language Support: CPP (old)Assignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: aspotashev, nalvarez
Priority: NOR    
Version First Reported In: git master   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Alexander 2010-09-12 19:57:10 UTC
Version:           SVN (using KDE 4.5.1) 
OS:                Linux

I'm using KDevelop 4.1 branch, git 2010-09-12.
Consider the following code:

#include <functional>
#include <algorithm>
#include <vector>

template <typename T>
bool lessthan(T a, T b)
{
	return a < b;
}

int main(int argc, char** argv)
{
	std::vector<int> v;
	std::sort(v.begin(), v.end(), std::ptr_fun(lessthan<int>));  // this line is red
	return 0;
}

the std::sort line is red ("Unexpected token 'int'"), even though it's a valid piece of code.


Reproducible: Always




openSUSE 11.3, x86_64, gcc 4.5.0, KDE 4.5.1 from openSUSE Build Service.
Comment 1 Nicolás Alvarez 2010-12-07 21:02:41 UTC
  foo(bar, baz<int>); 

...gives the same error, whether foo, bar and baz are declared or not.

  foo(quux<int>);

...is also misparsed, but in a different and even stranger way. 'quux<int>' is highlighted as a declaration(!). Its tooltip says "foo quux< int >" if foo isn't declared, or "function void (T) quux< int >" if foo is declared as a template function.
Comment 2 Kevin Funk 2018-03-25 22:45:30 UTC
Hello!

We are working on a new clang-based C/C++ language plugin for KDevelop 5 which
supersedes the old C++ plugin in KDevelop 4. See e.g.:
https://www.kdevelop.org/news/first-beta-release-kdevelop-500-available

Due to a lack of manpower, we cannot fix bugs in the old C++ plugin. We rather
want to supply a good Clang based C++ experience for KDevelop 5 than wasting
our time on the legacy C++ support for KDevelop 4.

With the new clang-based C/C++ language plugin, the bug presented here does not
occur. In my testing. For these reasons, I'll close this bug. Please stay tuned
for KDevelop 5.

If you think this bug is applicable to Clang/KDevelop 5, please reopen the
report and add new information on how to reproduce the bug there.