From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16723 invoked by alias); 28 Oct 2004 16:33:00 -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 16706 invoked by uid 48); 28 Oct 2004 16:32:59 -0000 Date: Thu, 28 Oct 2004 16:33:00 -0000 Message-ID: <20041028163259.16704.qmail@sourceware.org> From: "giovannibajo at libero dot it" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20040924081036.17648.hs@profiforms.de> References: <20040924081036.17648.hs@profiforms.de> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/17648] [3.3/3.4 Regression] template destructor was not called for inherited classes X-Bugzilla-Reason: CC X-SW-Source: 2004-10/txt/msg03515.txt.bz2 List-Id: ------- Additional Comments From giovannibajo at libero dot it 2004-10-28 16:32 ------- Volker, thanks for the reduction. The bug is hideous, look at this: ---------------------------- class A; template struct B { A* a; ~B() { delete a; } }; struct A { B<0> b; }; ---------------------------- When B's destructor is instantiated, A must be a complete type, otherwise this invokes undefined behaviour. Now, B's destructor is instantiated when A's destructor is instantiated (because it implicitally calls it), and at that point A is probably complete (because its definition is already finished). At least, I think so. This requires some legal help: is it true that B's destructor cannot be instantiated before its first use, which is in the implicit A's destructor? Is it true that, by the time that A's destructor is synthesized, A is a complete type? Either we have a codegen bug, or we are missing the warning (and probably missing it also from 3.4 and mainline, even if we *happen* to generate the correct code). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17648