This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/3400: doesn't compile simple hierarchy with overlaoding
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/3400: doesn't compile simple hierarchy with overlaoding
- From: volker dot reichenberger at iwr dot uni-heidelberg dot de
- Date: 25 Jun 2001 11:06:48 -0000
- Reply-To: volker dot reichenberger at iwr dot uni-heidelberg dot de
>Number: 3400
>Category: c++
>Synopsis: doesn't compile simple hierarchy with overlaoding
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Mon Jun 25 04:16:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Volker Reichenberger
>Release: gcc version 2.95.2 19991024 (release)
>Organization:
>Environment:
SuSe Linux 7.2 on IBM Thinkpad A21p
>Description:
When trying to compile the program
class A {public: void a() {};};class B: public A {public: void a(int n) {};};int main(void){ B b; b.a(); return 0;}
I get the error message:
test.cc: In function `int main()':
test.cc:15: no matching function for call to `B::a ()'
test.cc:8: candidates are: void B::a(int)
I believe the code is correct (so do all my colleagues). Changing the method name to 'b()' (or anything else) fixes the problem. The code snippet does not exhibit good programming style, but nonetheless it seems to be correct.
C++ books in my reach gave no help on the subject.
>How-To-Repeat:
Compile code with g++
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: