Cv-qualification and deletion
Section [expr.delete]

Created on 2020-10-29.00:00:00 last changed 2 months ago


Date: 2020-12-15.00:00:00

Notes from the December, 2020 teleconference:

“Similar types” raises issues with arrays of unknown bounds, but a change to allow for differences in cv-qualification is needed.

Date: 2020-10-29.00:00:00

(From editorial issue 4305.)

According to [expr.delete] paragraph 3,

In a single-object delete expression, if the static type of the object to be deleted is different from its dynamic type and the selected deallocation function (see below) is not a destroying operator delete, the static type shall be a base class of the dynamic type of the object to be deleted and the static type shall have a virtual destructor or the behavior is undefined. In an array delete expression, if the dynamic type of the object to be deleted differs from its static type, the behavior is undefined.

Both the static type and the dynamic type include cv-qualification, and requiring agreement in qualification between the two for deletion is not intended. Perhaps the restriction should be to similar types instead of identical types?

Date User Action Args
2021-02-17 00:00:00adminsetmessages: + msg6489
2020-10-29 00:00:00admincreate