public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/8117: Ambiguous base for multiple inheritance with pure virtual base
@ 2002-10-02 0:56 yuvalk
0 siblings, 0 replies; only message in thread
From: yuvalk @ 2002-10-02 0:56 UTC (permalink / raw)
To: gcc-gnats; +Cc: yuvalk, kostat, jluu
>Number: 8117
>Category: c++
>Synopsis: Ambiguous base for multiple inheritance with pure virtual base
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Wed Oct 02 00:56:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Yuval Kfir
>Release: 3.2
>Organization:
Mainsoft Co. Ltd.
>Environment:
System: Linux twins 2.4.18-3custom #1 SMP Thu Sep 19 12:30:28 IDT 2002 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-3.2/configure --prefix=/usr/gcc/3.2 --enable-languages=c,c++
>Description:
I have a class D which inherits B, C, both of which inherit A. All classes
except D contain only pure virtual functions, and D provides the implementation
for all of them.
When attempting to take the address of the function declared in A, the compiler generates the following error:
....................................................
test.cpp:28: `A' is an ambiguous base of `D'
test.cpp:28: confused by earlier errors, bailing out
....................................................
GCC 2.95.3 and GCC 2.96 compile this code without any errors/warnings.
>How-To-Repeat:
/************************************************/
/* Compile the following with `gcc -c test.cpp' */
/************************************************/
class A{
public:
virtual void a() = 0;
};
class B : public A
{
public:
virtual void b() = 0;
};
class C : public A
{
public:
virtual void c() = 0;
};
class D : public B, public C
{
public:
virtual void a() {}
virtual void b() {}
virtual void c() {}
typedef void ( D::*FNTYPE)(void);
static FNTYPE const s_fxn[];
};
D::FNTYPE const D::s_fxn[] = { (FNTYPE)&D::a };
/************************************************/
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-10-02 7:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-02 0:56 c++/8117: Ambiguous base for multiple inheritance with pure virtual base yuvalk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).