This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/11804] New: Wrong warning about explicit initialization of base class default constructor


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

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

           Summary: Wrong warning about explicit initialization of base
                    class default constructor
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nicolas dot burrus at lrde dot epita dot fr
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu

Fix:
I could not find in the documentation a -Wno-xxx flag disabling this warning.
------- Additional Comments From nicolas dot burrus at lrde dot epita dot fr  2003-08-05 10:11 -------
Considering the following code:

struct A {};

struct B : virtual public A {};

struct C : virtual public A {};

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

Here is the output of g++ (2.95, 3.0, 3.2, 3.3 and 3.4):

warning_base_class2.cc: In copy constructor `D::D(const D&)':
warning_base_class2.cc:9: warning: base class `struct B' should be explicitly 
   initialized in the copy constructor
warning_base_class2.cc:9: warning: base class `struct C' should be explicitly 
   initialized in the copy constructor

This seems odd since only default constructors are defined in B and
C. como -A and icc -Xc accepts this code without these warnings.

I noticed that this bug is quite close to PR c++/5645 (which seems to
have been reintroduced a while ago).

Environment:
System: Linux meissa 2.4.21 #1 Sat Jul 26 02:06:42 CEST 2003 i686 GNU/Linux
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /home/nes/work/lrde/ext/gcc/configure --prefix=/opt/gcc-3.4 --enable-languages=c,c++ : (reconfigured)

How-To-Repeat:
Compile the given code.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]