This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12883] destructor of array object not called if no prior instantiation of the template has happened
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Nov 2003 16:42:01 -0000
- Subject: [Bug c++/12883] destructor of array object not called if no prior instantiation of the template has happened
- References: <20031103115217.12883.mxm01@comm2000.it>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12883
bangerth at dealii dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |critical
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2003-11-03 16:41:59
date| |
Summary|array of auto_ptr's: |destructor of array object
|destructors not called |not called if no prior
|(under certain |instantiation of the
|circumstances) |template has happened
Target Milestone|--- |3.3.3
------- Additional Comments From bangerth at dealii dot org 2003-11-03 16:41 -------
Confirmed with all gcc versions back to 2.95. How odd.
Here's something significantly smaller:
--------------------
extern "C" void abort ();
template <int> struct X {
X(int) { }
~X() { abort(); }
};
int main() {
X<0> array[] = { 0 };
}
---------------------------
Of course we should call the destructor of the X object being created,
but none of the gcc versions since 2.95 and including mainline does
that. That's quite a bummer, so I add this with milestone 3.3.3.
Note that indeed, if one puts a
template struct X<0>;
after the declaration of X, then we _do_ call abort. Very weird.
W.