🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #821

Re: multible inheritance and virtual functions

#821
From: Mike Stump
Date: Sat, 29 Aug 1992 14:17
76 lines
2363 bytes
Yes, I have got it, yes, it is a known bug now.  (I am not sure if
this relates directly to other MI bugs that I have, but the reports
are always useful, even if I already have one for it.)

This is pretty high on the priority list, should be better by gcc 2.4,
gcc 2.3 will probably be out before it is fixed.  When I find a fix
for it, I will mail it to you (post to the list), if I can.

> Date: Mon, 20 Jul 92 17:06:20 +0200
> From: concept!rwr@ai.mit.edu (Roland Weber)
> Message-Id: <9207201506.AA05213@concept.uucp>
> Organization: concept engineering GmbH, D-7800 Freiburg, Germany
> To: bug-gcc@prep.ai.mit.edu

> We have newly installed gcc-2.2.2 on a SPARCstation using SUNOS 4.1.
> It seems to me, that a "hard bug" still remains.

> Look at the following example. I expect an output of
>     isA: 3 3 3 3
> but get:
>     isA: 3 3 3 2

> Could you pleace respond, if it is a known bug and if you will fix it.

> ----------- example c++ -----------------
> /* %Z%%M% %I% %E%
> 	g++ bug:
> 		multible inheritance of virtual functions...
> */

> class A1 {
> public:
> 			A1() {};
> 	virtual		~A1() {};
> 	virtual int	isA() {return 0;}
> };

> class A2 {
> public:
> 			A2() {};
> 	virtual		~A2() {};
> 	virtual int	isA() {return 1;}
> };

> // =============================================================================

> class B : public A1, public A2 {
> public:
> 			B() {};
> 	virtual		~B() {};
> 	virtual int	isA() {return 2;}
> };

> // =============================================================================

> class C : public B {
> public:
> 			C() {};
> 	virtual		~C() {};
> 	virtual int	isA() {return 3;}
> };

> // =============================================================================

> #include <stdio.h>

> main()
> {
> 	C*	c = new C;

> 	A1*	a1 = c;
> 	A2*	a2 = c;
> 	B*	b =  c;
> 	
> 	printf("isA: %d %d %d %d\n", c->isA(), b->isA(), a1->isA(), a2->isA());
> }
Technical Details
Message-ID: <9208291417.AA29079@cygnus.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!mrs

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!mrs
From: mrs@cygnus.com (Mike Stump)
Subject: Re:  multible inheritance and virtual functions
Message-ID: <9208291417.AA29079@cygnus.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Sat, 29 Aug 1992 14:17:33 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 79