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

[basic.life][class.dtor] Turn normatively redundant paragraphs for double destruction into notes #6389

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

frederick-vs-ja
Copy link
Contributor

Fixes #6374.

@frederick-vs-ja
Copy link
Contributor Author

I'm not sure [class.dtor] p18 can be turned into a note. [class.dtor] p4 doesn't seem to exclude destructors (see also cplusplus/CWG#435).

@sergey-anisimov-dev
Copy link

sergey-anisimov-dev commented Sep 28, 2023

[class.dtor#4] simply has no relevance here, no?
[class.dtor#18] (normatively) reads as follows:

Once a destructor is invoked for an object, the object's lifetime ends; the behavior is undefined if the destructor is invoked for an object whose lifetime has ended ([basic.life]).

The part before the semicolon is covered by [basic.life#1.4], while the part following it - by [basic.life#6.2] or [basic.life#7.2] with the exception of class-type objects going through a construction/destruction process which is denoted there to be covered separately (the remainder of the reasoning being that destructors consitute non-static member functions). Not having the destructors excluded from the list of what is allowed to call in [class.cdtor#4] constitutes a stand-alone issue: the one CWG2757 addresses (again, the intention of prohibiting the destructor calls is clearly there: the bottom third of the example demonstrates exactly that).

Edit: Nevermind all that: I've got the point. Your objection is fair, @frederick-vs-ja: the part following the semicolon indeed does introduce a new constraint. The problem is that it doesn't state anything about calling a destructor for an object whose lifetime hasn't yet begun, so the referred issue is still useful. And, given a more generic prohibition will be adopted, [class.dtor#18] would again constitute a redundancy in full.

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