This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/12883] destructor of array object not called if no prior instantiation of the template has happened


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]