public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jens dot maurer at gmx dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/29706]  New: rejects-valid: missing mem-initializer for virtual base class
Date: Fri, 03 Nov 2006 23:08:00 -0000	[thread overview]
Message-ID: <bug-29706-1824@http.gcc.gnu.org/bugzilla/> (raw)

This code snippet

struct V {
  V(int) { }
};

struct B : virtual V
{
  B() { }       // does not mention constructor of V
};

struct D : B
{
  D() : V(0) { }
};

D d;     // most derived object of type D

should be valid according to the C++ standard 12.6.2 paragraph 6 (note that B
is not a most derived class).  However, gcc complains about the definition of
the constructor for B, which is wrong, because the constructor for B is not
used to initialize a most derived object (it only initializes the B subobject
of D):

257-demo.cc: In constructor 'B::B()':
257-demo.cc:7: error: no matching function for call to 'V::V()'
257-demo.cc:2: note: candidates are: V::V(int)
257-demo.cc:1: note:                 V::V(const V&)


-- 
           Summary: rejects-valid: missing mem-initializer for virtual base
                    class
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jens dot maurer at gmx dot net
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


             reply	other threads:[~2006-11-03 23:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-03 23:08 jens dot maurer at gmx dot net [this message]
2006-11-03 23:20 ` [Bug c++/29706] " pinskia at gcc dot gnu dot org
2006-11-04 15:34 ` jens dot maurer at gmx dot net

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29706-1824@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).