Bug 272834

Summary: Cursor placement is wrong for functions with "(void)" arguments
Product: kdevelop Reporter: Rolf Eike Beer <kde>
Component: Language Support: CPP (Clang-based)Assignee: kdevelop-bugs-null
Status: RESOLVED WORKSFORME    
Severity: normal CC: aleixpol, amhndu, mail, sumeettulsani1
Priority: NOR    
Version: 5.2.1   
Target Milestone: ---   
Platform: openSUSE RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: The bug has already been resolved.
Bug has been resolved

Description Rolf Eike Beer 2011-05-09 08:10:09 UTC
Version:           4.2.1 (using KDE 4.6.2) 
OS:                Linux

Version is KDevelop 4.2.2 on KDE 4.6.3, but Bugzilla didn't have this versions available.

static int foo() { return 32; }
static int bar(void) { return 42; }

int main(void)
{
	int baz = 0;
	baz += foo();
	baz += bar();
	return baz;
}

Try duplicating the += lines and use code completion. You will see that for foo() the cursor is placed behind the closing brace, for bar() it is placed between the braces.


Reproducible: Always




OS: Linux (i686) release 2.6.37-12-desktop
Compiler: gcc
Comment 1 Rolf Eike Beer 2013-10-09 14:50:15 UTC
kdevplatform/language/codecompletion/codecompletionhelper.cpp::insertFunctionParenText() -> bool haveArguments should be adapted according to Milian
Comment 2 Sumeet Tulsani 2016-04-23 05:22:38 UTC
Created attachment 98529 [details]
The bug has already been resolved.

This screenshot shows the use of auto completion.
Comment 3 Sumeet Tulsani 2016-04-23 05:24:36 UTC
Created attachment 98530 [details]
Bug has been resolved

This screenshot shows that the cursor is being placed at correct position.
Comment 4 Kevin Funk 2016-04-23 18:18:54 UTC
@Rolf: Can you check if this issue is fixed in 5.0?
Comment 5 Francis Herne 2018-03-25 23:57:40 UTC
This bug is reversed (!) in 5.2-git with the Clang backend.

The cursor is now placed after the closing brace of `bar()`, but in the middle for `foo()`; it should be at the end in both cases.
Comment 6 Amish Naidu 2018-09-23 16:15:08 UTC
Works as intended with 5.3-git.