virtual inheritance bug
Jorge Monteiro
jomo@cayennesoft.nl
Tue Aug 18 04:32:00 GMT 1998
Hi,
I want to report a bug in egcs (egcs-2.91.54, but it's there since the first
time I tried egcs in version 1.0).
The bug is the following, if we have virtual inheritance after normal
inheritance egcs gets confused and doesn't let us access protected/private
methods of the base (non-virtual inheritance).
Here is a code sample:
ass ORB_proxy
{
protected:
int i;
virtual int destruct() { return 0; }
};
class Persistent_proxy: public ORB_proxy
{
protected:
virtual int destruct() { return 1; }
};
class CorporateBUG_proxy : virtual public Persistent_proxy
{
CorporateBUG_proxy()
{
ORB_proxy::i = 0;
ORB_proxy::destruct(); // Error????
}
};
class CorporateOK_proxy : public Persistent_proxy
{
CorporateOK_proxy()
{
ORB_proxy::i = 0;
ORB_proxy::destruct();
}
};
Compiling with egcs produces the following:
[bash]ganymedes{jomo}521: g++ virtual_inheritance_bug.cpp
virtual_inheritance_bug.cpp: In method
`CorporateBUG_proxy::CorporateBUG_proxy()':
virtual_inheritance_bug.cpp:5: `int ORB_proxy::destruct()' is protected
virtual_inheritance_bug.cpp:17: within this context
[bash]ganymedes{jomo}522:
NOTE: If we change Persistent_proxy to inherit virtually everything goes ok.
Is there any plans to fix this?
Thanks,
Jorge Monteiro mailto:jomo@cayennesoft.nl
Senior Software Engineer http://www.cayennesoft.com
Cayenne Software, Inc., Delft, The NetherLands
More information about the Gcc-bugs
mailing list