From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19823 invoked by alias); 4 Jun 2005 22:18:08 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 19816 invoked by uid 48); 4 Jun 2005 22:18:05 -0000 Date: Sat, 04 Jun 2005 22:18:00 -0000 From: "igodard at pacbell dot net" To: gcc-bugs@gcc.gnu.org Message-ID: <20050604221804.21917.igodard@pacbell.net> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/21917] New: Missing warning? (or error?) X-Bugzilla-Reason: CC X-SW-Source: 2005-06/txt/msg00489.txt.bz2 List-Id: struct virt { virt() : i(2) {} virt(int i) : i(i){} int i; }; struct der1 : public virtual virt { der1(int i) : virt(i) {} }; struct der2 : public virtual virt { der2(int i) : virt(i) {} }; struct top : public der1, public der2 { top () : der1(0), der2(1) {} }; int main() { top t; } Compiles without comment. However, the null constructor for "virt" is called rather than the explicit constructor that is indicated by the constructor chain from top. In fact, the der* constructors say " : virt(i)" but that sub-constructor will never be called because virt is a virtual base class. I don't know if it is actually an error to try to explicitly construct a virtual base, but is sure is misleading and I think deserves at least a warning. -- Summary: Missing warning? (or error?) Product: gcc Version: 3.4.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: igodard at pacbell dot net CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21917