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

[stmt.jump]/2 Wording does not apply to objects whose lifetime has ended #2871

Closed
sdkrystian opened this issue May 5, 2019 · 1 comment
Closed
Assignees

Comments

@sdkrystian
Copy link
Contributor

Issue

http://eel.is/c++draft/stmt.jump#2 says that objects with automatic storage duration are destroyed when leaving scope, however, if you end the lifetime of an object prematurely, it no longer exists, and since the wording in the standard only applies to objects during their lfetime, there would be no object to destroy, as the wording wouldn't apply an object who's lifetime is over.

Proposed Wording to fix:

[stmt.jump]/2
On exit from a scope (however accomplished), variables that refer to objects with automatic storage duration declared in that scope will be destroyed in the reverse order of their declaration. If a variable does not refer to an object and the type of the variable has a non-trivial destructor, the behavior is undefined.

@jensmaurer jensmaurer changed the title [stmt.jump]/2 Wording does not apply to objects who's lifetime has ended [stmt.jump]/2 Wording does not apply to objects whose lifetime has ended May 5, 2019
@jensmaurer
Copy link
Member

As explained in #2872, this is a bigger fish than what we want to fry editorially.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants