C++ bug with inheritance

Frank Pilhofer 520065607613-0001@t-online.de
Fri Jan 26 09:09:00 GMT 2001


   Hi,

 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):


    A ---- B -- Bi -----
     \      \           \
      \      \-----\     \
       \             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.

 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



-- 
Frank Pilhofer  ...........................................  fp@fpx.de
When money talks, nobody criticises its accent! - Alfred E. Neuman


More information about the Gcc-bugs mailing list