From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12830 invoked by alias); 14 Oct 2002 21:36:02 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 12810 invoked by uid 71); 14 Oct 2002 21:36:02 -0000 Resent-Date: 14 Oct 2002 21:36:02 -0000 Resent-Message-ID: <20021014213602.12809.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, snyder@fnal.gov Received: (qmail 11702 invoked from network); 14 Oct 2002 21:32:43 -0000 Received: from unknown (HELO d0sgibnl1.fnal.gov) (131.225.226.68) by sources.redhat.com with SMTP; 14 Oct 2002 21:32:43 -0000 Received: from localhost (snyder@localhost) by d0sgibnl1.fnal.gov (SGI-8.9.3/8.9.3) with SMTP id QAA63502 for ; Mon, 14 Oct 2002 16:32:42 -0500 (CDT) Message-Id: <200210142132.QAA63502@d0sgibnl1.fnal.gov> Date: Mon, 14 Oct 2002 14:36:00 -0000 From: snyder@fnal.gov Reply-To: snyder@fnal.gov To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: 3.113 Subject: c++/8227: g++ 3.3: ctors not called in static array initialization X-SW-Source: 2002-10/txt/msg00559.txt.bz2 List-Id: >Number: 8227 >Category: c++ >Synopsis: g++ 3.3: ctors not called in static array initialization >Confidential: no >Severity: critical >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Mon Oct 14 14:36:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: >Release: 3.3 20021014 (experimental) >Organization: >Environment: System: Linux karma 2.4.19-emp_2419p5a829i #1 Tue Sep 3 17:42:17 EST 2002 i686 unknown Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: ../gcc/configure --prefix=/usr/local/gcc --enable-threads=posix --enable-long-long --enable-languages=c,c++,f77 >Description: For the initialization of the static array in the program below, we generate calls to the class destructor, but there are no corresponding calls to the constructor. This is what i get when i run this program: $ g++ -o x x.cc $ ./x dtor 804973c $ If i change the program so that Cls is not a template class, then it executes correctly. >How-To-Repeat: ------------------------ extern "C" int printf (const char*, ...); template struct Cls { Cls () { printf ("ctor %x\n", this); } ~Cls () { printf ("dtor %x\n", this); } }; static Cls xxx[1]; int main () { return 0; } ------------------------ >Fix: >Release-Note: >Audit-Trail: >Unformatted: