c++/9782: constructor not called on higher-dimensional arrays of template types
bangerth@dealii.org
bangerth@dealii.org
Thu Feb 20 23:18:00 GMT 2003
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
More information about the Gcc-bugs
mailing list