🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

(none)

#1379
From: GNU Mailing List Maintenance
Date: Sun, 10 Jan 1993 15:31
78 lines
1814 bytes
Newsgroups: gnu.g++.bug
Path: csd.uwo.ca!min
From: min@csd.uwo.ca (Wei Min)
Subject: R: Another way to work around 
Organization: Department of Computer Science, University of Western Ontario, London
Date: Mon, 11 Jan 1993 01:31:31 GMT
Message-ID: <1993Jan11.013131.20484@julian.uwo.ca>
Sender: news@julian.uwo.ca (USENET News System)
Nntp-Posting-Host: gleep.csd.uwo.ca
Lines: 72

min          (min@csd.uwo.ca)

// gcc version 2.3.3 configured with ./configure sun4 on a Sun IPX.
// compiled with gcc -xc++ bug.c
// running ./a.out yields incorrect output
// I see:
//  D's create
//  D's create
//  D's create
//
// current workaround is to never compile the constructor from
// classes multiply-derived from the same parent in the same source
// file.  On tuesdays. 8-)
//
// -Eric uunet.uu.net!srg!enewton
//

extern "C" {
   void puts(const char *);
}

/*
	A   Q
	 \ /
	  C
	 / \
	D   E

*/

class A
{
 public:
  // virtual   CHANGE HERE. NO EMPTY VIRTUAL FUNCTION

	void f() {}
};

class Q
{
 public:
   virtual void create() { puts("Q's create"); }
};

class C : public A,public Q
{
};

class E : public C
{
 public:
   virtual void create() { puts("E's create"); }
};

class D : public C
{
 public:
   virtual void create() { puts("D's create"); }
};

main()
{
   C * p;
   p = new C; p->create();
   p = new D; p->create();
   p = new E; p->create();
}
Technical Details
Message-ID: <9301110444.AA28816@raisin-nut>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!ai.mit.edu!gnulists

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!ai.mit.edu!gnulists
From: gnulists@ai.mit.edu (GNU Mailing List Maintenance)
Subject: (none)
Message-ID: <9301110444.AA28816@raisin-nut>
Sender: daemon@cis.ohio-state.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Sun, 10 Jan 1993 15:31:33 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 84