Title
Storage deallocation during period of destruction
Status
open
Section
6.7.3 [basic.life]
Submitter
Richard Smith

Created on 2016-04-12.00:00:00 last changed 9 months ago

Messages

Date: 2023-07-15.00:00:00

Additional notes (July, 2023)

This issue is a subset of issue 2757.

Date: 2016-12-15.00:00:00

Notes from the December, 2016 teleconference:

The consensus view was that this should be undefined behavior.

Date: 2022-02-18.07:47:23

What happens if the storage for an object is deallocated in its period of destruction? Consider:

  struct Base {
    virtual ~Base() {
      ::operator delete(this);
    }
    void operator delete(void*) {}
  };

  struct Derived : Base {};

  int main() {
    delete new Derived;
  } 

This ought to be undefined behavior, but the standard is silent on the matter.

History
Date User Action Args
2023-07-05 14:35:51adminsetmessages: + msg7353
2017-02-06 00:00:00adminsetmessages: + msg5767
2016-04-12 00:00:00admincreate