This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c++/4240: overloaded virtual functions getting lost in class hierarchy
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/4240: overloaded virtual functions getting lost in class hierarchy
- From: J dot D dot Lamb at btinternet dot com
- Date: 5 Sep 2001 20:59:26 -0000
- Reply-To: J dot D dot Lamb at btinternet dot com
>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=