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

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-10-28 
09:17:23 UTC ---
I've relied on exactly this behaviour and wouldn't want a warning.

struct Base : virtual std::ios {
  Base() : std::ios(0) { }
  std::streambuf buf;
};

struct MyStream : Base, std::iostream {
  MyStream() : std::iostream(0) { }
};

If a concrete Base is constructed I want to call ios::ios(0) but if a MyStream
is constructed then I want to call the ios::ios() default ctor and then have
iostream::iostream(0) call ios::init(0)

If this warning is added (which I'm not convinced it should be) then it should
not be given if the most-derived class *explicitly* uses a different ctor for
the virtual base i.e. I could suppress the warning by changing the code above
like so:

  MyStream() : std::ios(), std::iostream(0) { }
               ^^^^^^^^^^^

I also don't think the warning should be given if the unused mem-initializer in
der1 and der2 calls the same constructor as is implicitly called by the
most-derived class, i.e. if der1 and der2 called virt() then that has the same
effect as the implicit initialization done by top.

I don't think this should be P2, and I think a better summary would be "Missing
warning when virtual base is initialized with different constructor than
requested by an ignored mem-initializer"

Reply via email to