From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4289 invoked by alias); 17 Oct 2007 11:26:23 -0000 Received: (qmail 4245 invoked by uid 48); 17 Oct 2007 11:26:12 -0000 Date: Wed, 17 Oct 2007 11:26:00 -0000 Message-ID: <20071017112612.4244.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/5645] gcc warns that pure virtual class not explicitly initialized In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "manu at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-10/txt/msg01526.txt.bz2 ------- Comment #4 from manu at gcc dot gnu dot org 2007-10-17 11:26 ------- Does this patch makes any sense? This needs testcases (suggestions for extra testcases are welcome), Changelog, bootstrap + testing and proper submission. --- init.c 2007-09-20 15:13:00.000000000 +0100 +++ init.c.fixed 2007-10-17 12:20:24.000000000 +0100 @@ -684,10 +684,11 @@ emit_mem_initializers (tree mem_inits) /* If these initializations are taking place in a copy constructor, the base class should probably be explicitly - initialized. */ + initialized unless it is nearly empty. */ if (extra_warnings && !arguments && DECL_COPY_CONSTRUCTOR_P (current_function_decl) - && TYPE_NEEDS_CONSTRUCTING (BINFO_TYPE (subobject))) + && TYPE_NEEDS_CONSTRUCTING (BINFO_TYPE (subobject)) + && !CLASSTYPE_NEARLY_EMPTY_P (BINFO_TYPE (subobject)) warning (OPT_Wextra, "%Jbase class %q#T should be explicitly initialized in the " "copy constructor", current_function_decl, BINFO_TYPE (subobject)); -- manu at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed|2005-12-11 21:53:55 |2007-10-17 11:26:12 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5645