Bug 78641 - code completion: overloaded members in derived classes not hidden when redefined
Summary: code completion: overloaded members in derived classes not hidden when redefined
Alias: None
Product: kdevelop
Classification: Unclassified
Component: Code completion (show other bugs)
Version: 3.0.2
Platform: unspecified Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: KDevelop Developers
Depends on:
Reported: 2004-03-28 21:46 UTC by Daniel Franke
Modified: 2007-01-19 20:02 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Franke 2004-03-28 21:46:00 UTC
Version:           3.0.2 (using KDE 3.2.1, compiled sources)
Compiler:          gcc version 3.3.1 (SuSE Linux)
OS:          Linux (i686) release 2.4.21-99-default


Assume two simple classes (stripped down example):
class A {
      void print(const string& t) { print(t.c_str()); }
      virtual void print(const char *s) { cout << "A: " << s; }

class B : public A {
      void print(const char *s) { cout << "B: " << s; }

and a short code snipplet:

string hello = "Hello";
A *a = new B;
Here code completion offers both print-methods, therefore:
string hello = "Hello";
A *a = new B;
As expected, gcc compiles the code, "Hello" is printed at stdout.

A small change:
string hello = "Hello";
B *b = new B;
Again, code completion offers both print methods.
string hello = "Hello";
B *b = new B;
gcc complains:
home/daniel/cvs/test/src/test.cpp: In function `int main(int, char**)':
/home/daniel/cvs/test/src/test.cpp:51: error: no matching function for
call to `B::print(std::string)'
/home/daniel/cvs/test/src/test.cpp:42: error: candidates are: virtual void
B::print(const char*)

Jens Dagerbo wrote (kdevelop-devel):

Quoting Eckel:
"If a base class has a function name that's overloaded several times, 
redefining that function name in the derived class will hide _all_ the 
base-class versions."

I don't think this is the worst bug in the CC mechanism, but it is incorrect 
and should probably be reported. ;)
Comment 1 Daniel Franke 2005-01-14 14:26:33 UTC
Still valid in kdevelop-3.1.91, KDE-3.3.91 (beta1), CVS 050113
Comment 2 Amilcar do Carmo Lucas 2005-01-14 14:33:51 UTC
Daniel seams to be a very good user. I trush him.
Comment 3 David Nolden 2007-01-19 20:02:12 UTC
Fixed in current svn