public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/9782: constructor not called on higher-dimensional arrays of template types
@ 2003-02-20 23:18 bangerth
0 siblings, 0 replies; only message in thread
From: bangerth @ 2003-02-20 23:18 UTC (permalink / raw)
To: Michael.J.Kenny, gcc-bugs, gcc-prs, nobody
Old Synopsis: constructor not called on typedef'd templated object
New Synopsis: constructor not called on higher-dimensional arrays of template types
State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Thu Feb 20 23:18:14 2003
State-Changed-Why:
Confirmed with 2.95...present mainline. Problem is more
convenient to see here:
----------------------------------
extern "C" void printf(char *, ...);
template <int>
struct A {
A() {printf("A::A()\n");}
};
struct B {
B() {printf("B::B()\n");}
};
int main () {
new A<0>[1][1]; // constructor apparently _not_ called
new B [1][1]; // constructor _is_ called
}
-------------------------------
A and B differ only in that one is a template and the
other is not. Yet, only the constructor of B is called:
x/bug> /home/bangerth/bin/gcc-3.4-pre/bin/c++ test.C
x/bug> ./a.out
B::B()
If we have a 1d array, both constructors run, as expected.
W.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9782
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-02-20 23:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-20 23:18 c++/9782: constructor not called on higher-dimensional arrays of template types bangerth
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).