-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Full name of submitter: JMC
Reference (section label): [basic.life]
Link to reflector thread (if any): https://stackoverflow.com/questions/77023929/c23-changes-disallow-using-dynamically-allocated-array-as-storage-provider
Issue description:
CWG2625 did to [basic.life]/6.1:
… after the lifetime of an object has ended … The program has undefined behavior if:
•the object will be or was of a class type with a non-trivial destructor andthe pointer is used as the operand of a delete-expression,
now consider
auto buf = new unsigned char[sizeof(int)];
new (buf) int; // kills buf[0]
delete[] buf; // the pointer to buf[0] is used as the operand of delete-expressionSuggested resolution:
Undo CWG2625 resolution. Or, at least, limit the restriction to single-object delete expression.
Metadata
Metadata
Assignees
Labels
No labels