-
Notifications
You must be signed in to change notification settings - Fork 7
[class.cdtor] explicitly invoking a destructor from a constructor CWG2757 #435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It might be simpler to add the prohibition to [class.cdtor] p4. |
Might be a valid consideration. It's just that presently that clause is centered around the infamous static binding of the virtual functions in constructors/destructors. It might just be better to leave it be and group somewhat-related operations of "free"/"delete"/"destroy" together as CWG2757 originally intends. |
This seems to be pointing to a defect in the suggested wording for CWG2757. I've amended the suggested wording. |
I'll just leave a note on the fact that this supposedly allows for delete-exprs that resolve into a destroying-delete (neither the destructor calls, nor the storage reuses/releases are guaranteed under such circumstances: the behavior is user-defined). This most likely isn't a problem though for the very same reasons. |
I think, given
http://eel.is/c++draft/class.dtor#18 can be completely removed, because, during construction/destruction, this is covered by the newly-proposed wording, and by http://eel.is/c++draft/basic.life#6.2 / http://eel.is/c++draft/basic.life#7.2 otherwise (OTOH, as it is known, http://eel.is/c++draft/class.dtor#18 conflicts with http://eel.is/c++draft/basic.life#9.sentence-1 a bit, in «non-trivial destructor» requirement) |
That is the idea: perhaps you would be interested in reviewing this issue, @languagelawyer (especially concerning [basic.life#9]). |
Full name of submitter (unless configured in github; will be published with the issue): Sergey Anisimov
Reference (section label): [class.cdtor]
Issue description: Basically, CWG2757 doesn't address the issue normatively, only informatively: it mentions using a delete-expr or reusing/releasing the storage for the object, while an explicit destructor call constitutes neither. The intention is there though, apparently, since the example supplemented features such a situation.
Suggested resolution: Insert
, invoking a destructor for the object
betweenevaluating a delete-expression with an operand that points to the object
andor releasing or reusing (6.7.3 [basic.life]) the storage which the object occupies
within the normative part of the resolution already proposed.The text was updated successfully, but these errors were encountered: