public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11804] New: Wrong warning about explicit initialization of base class default constructor
@ 2003-08-05 10:11 gcc-bugzilla at gcc dot gnu dot org
  2003-08-05 13:55 ` [Bug c++/11804] " pinskia at physics dot uc dot edu
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2003-08-05 10:11 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-04-27  1:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-05 10:11 [Bug c++/11804] New: Wrong warning about explicit initialization of base class default constructor gcc-bugzilla at gcc dot gnu dot org
2003-08-05 13:55 ` [Bug c++/11804] " pinskia at physics dot uc dot edu
2003-08-27 14:32 ` lerdsuwa at gcc dot gnu dot org
2003-08-27 15:38 ` nicolas dot burrus at lrde dot epita dot fr
2003-08-27 16:01 ` bangerth at dealii dot org
2003-08-28 14:49 ` pinskia at gcc dot gnu dot org
2004-02-18 10:38 ` okohlbacher at gmx dot de
2004-04-27  2:53 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).