[Bug c++/11159] errornous warning in copy ctor with virtual inheritance

boris@kolpackov.net gcc-bugzilla@gcc.gnu.org
Mon Jun 16 20:49:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11159



------- Additional Comments From boris@kolpackov.net  2003-06-16 20:49 -------
> Yes, I think I can sort-of agree. I mean, the warning is not wrong, but
> it's not overly helpful in this case. It is just thought of as a reminder
> that you need to initialize virtual base classes in every derived class,
> which is different from classes without virtual bases.

This applies to any ctor. However warning is issued only for copy ctor.

> So it is good style to make it explicit.

This is arguable. For instance one may have a huge hierarchy (like syntax 
tree) and it's designed to use default ctor then making calls to those ctors 
explicit is nothing but code bloat. 

> I leave it to others to decide what to do with this. I think, it's easy to
> work around this, it removes a potential source in your code, and it 
> improves your code quality (stylewise), so the warning does indeed have 
> its justification.

The idea behind this warning may have its justification. However its 
implementation is inconsistent.



More information about the Gcc-bugs mailing list