This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/64445] New: virtual functions polymorphism
- From: "nagl46 at web dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 30 Dec 2014 14:36:40 +0000
- Subject: [Bug c++/64445] New: virtual functions polymorphism
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64445
Bug ID: 64445
Summary: virtual functions polymorphism
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: nagl46 at web dot de
Created attachment 34364
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34364&action=edit
example of described bug
A base class "base" has two virtual functions
virtual void Y( float xx );
virtual void Y( int xx);
A new class "ext" that inherits from base class re-implements the function
virtual void Y( float xx );
Calling function Y(float) on a pointer "base *" pointing to an ext instance
results in a call to "base::Y(int)".
I would expect a call to the "ext::Y(float)" function. Is it a bug or is it my
mistake?
It's the same behavior in gcc 4.7.2 and gcc 5.0.0.