Problem with virtual inheritance
Martin v. Loewis
martin@mira.isdn.cs.tu-berlin.de
Mon Nov 1 09:18:00 GMT 1999
> I *may* have found a bug in G++ 2.95.1, and from what I could
> read it hasn't been addressed in 2.95.2. Platform is RedHat Linux
> 6.0 on i686.
Thanks for your bug report. The compiler is right; the program does
what it should do.
> I cannot read from the standard (The C++ programming language by Bjarne
> Stroustrup, third edition) whether it's my code that's wrong, or the
> compiler.
[I don't have the book here, right now, but I can't imagine that this
is not explained].
Please re-read the section on virtual inheritance, and look for
explanations of constructor calls. Constructors of virtual bases are
called directly from the most derived class; ctor-initialisers in base
classes are not executed.
If the most derived class does not mention the virtual base in its
ctor-initialiser list, the parameterless constructor is used. If there
is no such constructor, the program is ill-formed.
If you can't find it in the book, please discuss this on
comp.lang.c++.moderated. If you then still think there is a book in
the compiler, feel free to resubmit your report.
Hope this helps,
Martin
More information about the Gcc-bugs
mailing list