From mboxrd@z Thu Jan 1 00:00:00 1970 From: J.D.Lamb@btinternet.com To: gcc-gnats@gcc.gnu.org Subject: c++/4240: overloaded virtual functions getting lost in class hierarchy Date: Wed, 05 Sep 2001 14:06:00 -0000 Message-id: <20010905205926.10111.qmail@sourceware.cygnus.com> X-SW-Source: 2001-09/msg00111.html List-Id: >Number: 4240 >Category: c++ >Synopsis: overloaded virtual functions getting lost in class hierarchy >Confidential: no >Severity: non-critical >Priority: low >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Wed Sep 05 14:06:00 PDT 2001 >Closed-Date: >Last-Modified: >Originator: J D Lamb >Release: 2.95.2 19991024 (release) >Organization: >Environment: Linux 2.4.2 #2 i686 (SuSE 6.4) >Description: A function in class A has overloaded virtual and non-virtual versions. The virtual version is redefined in public subclass B. The non-virtual function is not found in subclass C of B. There is an easy workaround: don't overload function name. Error message: no matching function for call to `C::get_a (B &)' candidates are: int B::get_a() >How-To-Repeat: >Fix: Change name of one of the functions. >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="test4.cc" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="test4.cc" Y2xhc3MgQSB7CnB1YmxpYzoKICBBKCBpbnQgYSApIDogYSggYSApIHt9CnByb3RlY3RlZDoKICB2 aXJ0dWFsIGludCBnZXRfYSgpIHsgcmV0dXJuIGE7IH0KICBzdGF0aWMgaW50IGdldF9hKCBBJiBh ICkgeyBhLmdldF9hKCk7IH07CnByaXZhdGU6CiAgaW50IGE7Cn07CgpjbGFzcyBCIDogcHVibGlj IEEgewogcHVibGljOgogIGludCBnZXRfYSgpIHsgcmV0dXJuIDA7IH0KICBCKCBpbnQgYSApIDog QSAoIGEgKSB7fQp9OwoKY2xhc3MgQyA6IHB1YmxpYyBCIHsKcHVibGljOgogIEMoIGludCBhICkg OiBCKCAwICksIGIoIGEgKSB7fQogIGludCBnZXRfdmFsKCkgeyByZXR1cm4gZ2V0X2EoIGIgKTsg fQpwcml2YXRlOgogIEIgYjsKfTsKCmludCBtYWluKCl7CiAgZXhpdCgwKTsKfQo=