Issue2256

Title 2256. Lifetime of trivially-destructible objects
Status drafting Section 6.8 [basic.life]
Submitter Richard Smith

Created on 2016-03-30.00:00:00 by admin, last changed by admin.

Messages
msg6189 (view) Date: 2018-03-15.00:00:00

Notes from the March, 2018 meeting:

CWG agreed with the suggested direction.

msg5883 (view) Date: 2018-04-11.00:00:00

According to 6.4 [basic.lookup] bullet 1.4, the following example has defined behavior because the lifetime of n extends until its storage is released, which is after a's destructor runs:

  void f() { 
    struct A { int *p; ~A() { *p = 0; } } a; 
    int n; 
    a.p = &n; 
  } 

It would be more consistent if the end of the lifetime of all objects, regardless of whether they have a non-trivial destructor, were treated the same.

History
Date User Action Args
2018-04-11 00:00:00adminsetstatus: open -> drafting
2018-04-11 00:00:00adminsetmessages: + msg6189
2018-02-27 00:00:00adminsetsection: 3.8 [basic.life] -> 6.8 [basic.life]
2016-03-30 00:00:00admincreate