This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/1782: C++ erroneous requirement for final overrider
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/1782: C++ erroneous requirement for final overrider
- From: 520065607613-0001 at t-online dot de
- Date: Fri, 26 Jan 2001 18:23:28 +0100
- Cc: fp at fpx dot de
- Reply-To: fp at fpx dot de
>Number: 1782
>Category: c++
>Synopsis: C++ erroneous requirement for final overrider
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Fri Jan 26 09:36:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Frank Pilhofer
>Release: 2.97 20010122 (experimental)
>Organization:
>Environment:
System: Linux rose 2.2.13 #1 Mon Nov 8 15:08:22 CET 1999 i586 unknown
Architecture: i586
host: i586-pc-linux-gnu
build: i586-pc-linux-gnu
target: i586-pc-linux-gnu
configured with: ../configure --prefix=/local/pkg/gcc/20010122 --with-gnu-as=/local/bin/as --with-gnu-ld=/local/bin/ld
>Description:
I have attached a C++ test case that breaks the current 01/22 snapshot
and has been reported to me back to the 2.96 pseudo-release. This bug
happens with a complex inheritance hierarchy (base class leftmost):
/-- Bi ---\
/ \
/---- B ------\ \
A D --- Di
\---- C ------/ /
\ /
\-- Ci ---/
The classes A, B, C and D each implement a virtual function f(), the
classes Bi, Ci and Di don't.
For background, this class hierarchy comes from CORBA, where A is an
abstract base class of all skeletons, B, C and D are generated skeleton
classes, where interface D inherits B and C. Bi, Ci and Di are the user
implementations for each interface, using implementation inheritance
for Di.
c++ -v -c test.cc yields
gcc version 2.97 20010122 (experimental)
test.cc:22: sorry, not implemented: `function_decl' not supported by dump_type
test.cc:22: no unique final overrider for `struct Di' in `<type error>'
test.cc:22: candidates are: `virtual void B::f()'
test.cc:22: `virtual void C::f()'
(error repeating three times with the same line number and content).
Line number 22 contains the declaration of class Di.
I would like this code to compile cleanly. According to ISO 14882
(Ansi C++), §10.2, par. 2 (p. 166), "a member name f in one sub-object
B hides a member name f in a sub-object A if A is a base class sub-
object of B. Any declarations that are so hidden are eliminated from
consideration."
Therefore, D::f hides both B::f and C::f, and there is no ambiguity.
Frank
>How-To-Repeat:
struct A {
virtual void f ();
};
struct B : virtual public A {
void f ();
};
struct C : virtual public A {
void f ();
};
struct D : virtual public B, virtual public C {
void f ();
};
struct Bi : virtual public B {};
struct Ci : virtual public C {};
struct Di : virtual public Bi, virtual public Ci, virtual public D {};
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: