Bug 211652

Summary: Cpp marks uses for first match, not best match according to types, if the argument is a character
Product: [Applications] kdevelop Reporter: Milian Wolff <mail>
Component: Language Support: CPP (old)Assignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: david.nolden.kde
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Unspecified   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Milian Wolff 2009-10-24 16:03:55 UTC
Version:            (using KDE 4.3.2)
Installed from:    Archlinux Packages

The cpp language plugin does not mark uses correctly under certain conditions. I don't know the exact name for it, but the problem is the following:

void foo(int i);
void foo(char c);

foo('a');

=> marked as use of foo(int i), instead of foo(char c). Afaik, a real compiler uses the function with the "best matching" signature, i.e. with the least type conversions.

I have this problem often with QString's methods like remove, replace etc.
Comment 1 Milian Wolff 2009-10-24 16:05:27 UTC
Here's a better testcase:

void foo(int i){}
void foo(char c){}

int main() {
  foo('a');
}