public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/8227: g++ 3.3: ctors not called in static array initialization
@ 2002-10-14 14:36 snyder
0 siblings, 0 replies; only message in thread
From: snyder @ 2002-10-14 14:36 UTC (permalink / raw)
To: gcc-gnats
>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:
<organization of PR author (multiple lines)>
>Environment:
System: Linux karma 2.4.19-emp_2419p5a829i #1 Tue Sep 3 17:42:17 EST 2002 i686 unknown
Architecture: i686
<machine, os, target, libraries (multiple lines)>
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 <class T>
struct Cls
{
Cls () { printf ("ctor %x\n", this); }
~Cls () { printf ("dtor %x\n", this); }
};
static Cls<int> xxx[1];
int main ()
{
return 0;
}
------------------------
>Fix:
<how to correct or work around the problem, if known (multiple lines)>
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-10-14 21:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-14 14:36 c++/8227: g++ 3.3: ctors not called in static array initialization snyder
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).