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

boris@kolpackov.net gcc-bugzilla@gcc.gnu.org
Wed Jun 11 19:08: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

           Summary: errornous warning in copy ctor with virtual inheritance
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: boris@kolpackov.net
                CC: gcc-bugs@gcc.gnu.org
 GCC build triplet: i386-gnu-linux
  GCC host triplet: i386-gnu-linux
GCC target triplet: i386-gnu-linux

Compiling the following code 

struct A
{
  A ();
};

struct B : virtual A
{
  B ();
};

struct C : virtual A
{
  C ();
};

struct D : B, C
{
  D (D const&){}
};

reults in the following diagnistic:

#g++ -W -c ./copyctor.cpp

copyctor.cpp: In copy constructor `D::D(const D&)':
copyctor.cpp:18: warning: base class `struct A' should be explicitly 
   initialized in the copy constructor
copyctor.cpp:18: warning: base class `struct B' should be explicitly 
   initialized in the copy constructor
copyctor.cpp:18: warning: base class `struct C' should be explicitly 
   initialized in the copy constructor



More information about the Gcc-bugs mailing list