Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Roland Weber
Mon, 20 Jul 1992 19:06
multible inheritance and virtual functions
Author: Roland Weber
Date: Mon, 20 Jul 1992 19:06
Date: Mon, 20 Jul 1992 19:06
77 lines
2305 bytes
2305 bytes
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.
Thank you,
Roland.
================================================================================
Roland Weber | Tel.: ..49-761-473099
concept engineering GmbH | Fax.: ..49-761-441063
Burkheimer Str. 10 |
D-7800 Freiburg (Germany West) |
--------------------------------------------------------------------------------
Email: rwr@concept.de
or: (uucp domain) rwr@concept.uucp
or: (uucp notation) ...!unido!concept!rwr
================================================================================
----------- 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());
}
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads