[prev in list] [next in list] [prev in thread] [next in thread]
List: kdevelop-devel
Subject: code completion
From: "Daniel Franke" <daniel.franke () imbs ! uni-luebeck ! de>
Date: 2004-03-26 17:17:43
Message-ID: 32842.68.76.87.72.1080321463.squirrel () webmail ! uni-luebeck ! de
[Download RAW message or body]
Hi all!
I had fun with gcc and code completion yesterday evening. I assume, one of
them fools me, but I don't know which ...
Assume two simple classes (stripped down example):
--
class A {
public:
void print(const string& t) { print(t.c_str()); }
virtual void print(const char *s) { cout << "A: " << s; }
};
class B : public A {
public:
void print(const char *s) { cout << "B: " << s; }
};
--
and a short code snipplet:
--
string hello = "Hello";
A *a = new B;
a->[ctrl+space]
--
Here code completion offers both print-methods, therefore:
--
string hello = "Hello";
A *a = new B;
a->print(hello)
--
As expected, gcc compiles the code, "Hello" is printed at stdout.
A small change:
--
string hello = "Hello";
B *b = new B;
b->[ctrl+space]
--
Again, code completion offers both print methods.
--
string hello = "Hello";
B *b = new B;
b->print(hello);
--
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*)
--
Therefore, either code completion shouldn't offer derived methods when
they are not available - or gcc should have a closer look?
I don't know - is there a bug, and if yes, where?
Daniel
version:
kdevelop 3.0.2 (KDE-3.2.1 release)
gcc-3.3.1 (SuSE 9.0)
_______________________________________________
Kdevelop-devel mailing list
Kdevelop-devel@barney.cs.uni-potsdam.de
http://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic