Title
Order of destruction of local automatics of destructor
Status
tc1
Section
15.4 [class.dtor]
Submitter
Gerhard Menzl

Created on 2000-01-07.00:00:00 last changed 208 months ago

Messages

Date: 2000-04-15.00:00:00

Proposed resolution (10/00):

In 15.4 [class.dtor] paragraph 6, change

A destructor for class X calls the destructors for X's direct members, ...
to
After executing the body of the destructor and destroying any automatic objects allocated within the body, a destructor for class X calls the destructors for X's direct members, ...

Date: 2003-04-25.00:00:00

The Standard is not clear whether automatic objects in a destructor are destroyed before or after the destruction of the class's base and member subobjects. That is, given

    struct S { ~S(); };

    struct T {
        S x;
        ~T() {
            S y;
        };
    };

which will be destroyed first, x or y?

History
Date User Action Args
2003-04-25 00:00:00adminsetstatus: dr -> tc1
2000-11-18 00:00:00adminsetstatus: ready -> dr
2000-05-21 00:00:00adminsetmessages: + msg315
2000-05-21 00:00:00adminsetstatus: open -> ready
2000-01-07 00:00:00admincreate