Created on 2013-01-13.00:00:00 last changed 131 months ago
[Moved to DR at the April, 2013 meeting.]
Proposed resolution (February, 2013):
Change 11.4.7 [class.dtor] paragraph 13 as follows:
In an explicit destructor call, the destructor name appears as a ~ followed by a type-name or decltype-specifier that denotes the destructor's class type. The invocation of a destructor is subject to the usual rules for member functions (11.4.2 [class.mfct]),; that is, if the object is not of the destructor's class type and not of a class derived from the destructor's class type (including when the destructor is invoked via a null pointer value), the program has undefined behavior(except that invoking delete on a null pointer has no effect). [Note: invoking delete on a null pointer does not call the destructor; see 7.6.2.9 [expr.delete]. —end note] [Example:...
According to 11.4.7 [class.dtor] paragraph 13,
The invocation of a destructor is subject to the usual rules for member functions (11.4.2 [class.mfct]), that is, if the object is not of the destructor's class type and not of a class derived from the destructor's class type, the program has undefined behavior (except that invoking delete on a null pointer has no effect).
While true, the final parenthetical comment concerns a delete-expression, not an explicit destructor call. Its presence here could mislead a careless reader to think that invoking a destructor with a null pointer is harmless. It should be deleted.
History | |||
---|---|---|---|
Date | User | Action | Args |
2014-03-03 00:00:00 | admin | set | status: drwp -> cd3 |
2013-10-14 00:00:00 | admin | set | status: dr -> drwp |
2013-05-03 00:00:00 | admin | set | messages: + msg4415 |
2013-05-03 00:00:00 | admin | set | status: tentatively ready -> dr |
2013-03-18 00:00:00 | admin | set | messages: + msg4248 |
2013-03-18 00:00:00 | admin | set | status: drafting -> tentatively ready |
2013-01-13 00:00:00 | admin | create |