[Bug c++/64445] New: virtual functions polymorphism
nagl46 at web dot de
gcc-bugzilla@gcc.gnu.org
Tue Dec 30 14:36:00 GMT 2014
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.
More information about the Gcc-bugs
mailing list