Skip to content
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

[intro.execution] A full-expression is: an invocation of a destructor generated at the end of the lifetime #4052

Open
languagelawyer opened this issue Jun 20, 2020 · 8 comments
Labels
cwg Issue must be reviewed by CWG.

Comments

@languagelawyer
Copy link
Contributor

This is unclear. The lifetime ends when a destructor's call start, not the other way around, but this is just a wording bug. It is not specified when such invocations are generated.

@jensmaurer
Copy link
Member

What exactly is your concern here? That "at the end of the lifetime" should be "near the end of the lifetime" or similar? Something else?

@languagelawyer
Copy link
Contributor Author

@jensmaurer

It is not specified when such invocations are generated.

When exit from block? When the subobjects are destroyed after destructor's body finishes execution? I assume both of this. Does this include the case when in partially initialized aggregate some constructor throws and already constructed members are destroyed? Probably not.

Maybe it is specified somewhere and I couldn't find it.

@jensmaurer
Copy link
Member

This is a definition of "full-expression".

Invocations of the destructors mentioned here occur on exit from the block [stmt.jump], on exit from a thread, or on termination of a program. [basic.start.term]

@languagelawyer
Copy link
Contributor Author

Invocations of the destructors mentioned here occur on exit from the block [stmt.jump], on exit from a thread, or on termination of a program. [basic.start.term]

Ok, but those paragraphs also don't say that the invocations of the destructors there are very those invocations mentioned in the definition of full-expression.

@jensmaurer
Copy link
Member

How and where else would destructor invocations be generated at the end of the lifetime of an object? The full-expression definition means all such implicit destructor invocations are in scope.
I'm not seeing a problem, sorry.

@languagelawyer
Copy link
Contributor Author

How and where else would destructor invocations be generated at the end of the lifetime of an object?

when in partially initialized aggregate some constructor throws and already constructed members are destroyed

And I don't understand why are you saying "destructor invocations be generated at the end of the lifetime of an object". We end the lifetime of an object by generating destructor invocation for it, not the other way around. Maybe you mean "when its storage duration would end"?

@jensmaurer
Copy link
Member

Storage duration and destruction are different.Those mentioned locations tell you when an object is destroyed, not when the storage duration ends. The full-expression section just says "those particular invocations are full-expressions", nothing else. Could you please suggest a specific change that you want to see applied?

@languagelawyer
Copy link
Contributor Author

Could you please suggest a specific change that you want to see applied?

If to speak purely about wording, I'd say s/generated at the end of the lifetime/generated to end the lifetime/.

The full-expression definition means all such implicit destructor invocations are in scope.

I don't understand why it is clear that this bullet means only invocations of destructors for variables on block, thread or program exit, but doesn't mean invocations of destructor for constructed aggregate elements when constructor of one of them throws during parent aggregate initialization. These destructor invocations are not generated? Or because if we consider the last case to be a full-expression, this would be incompatible with objects destruction order? (In reverse to their construction order).

@jensmaurer jensmaurer added the decision-required A decision of the editorial group (or the Project Editor) is required. label Sep 8, 2020
@jensmaurer jensmaurer added cwg Issue must be reviewed by CWG. and removed decision-required A decision of the editorial group (or the Project Editor) is required. labels Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cwg Issue must be reviewed by CWG.
Projects
None yet
Development

No branches or pull requests

2 participants