Skip to content

CWG2993 [dcl.fct.def.general] Informal references to the "body" of a destructor #672

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

Open
hubert-reinterpretcast opened this issue Feb 14, 2025 · 3 comments

Comments

@hubert-reinterpretcast
Copy link
Collaborator

Full name of submitter (unless configured in github; will be published with the issue): Hubert Tong

Reference (section label): dcl.fct.def.general

Link to reflector thread (if any): N/A

Issue description:
https://wg21.link/dcl.fct.def.general#1 explains that various actions performed by constructors without syntactically being present are considered part of the body of the constructor. No similar statement is made with respect to destructors.

Suggested resolution:
Any informal reference to the body of a function should be interpreted as a reference to the non-terminal function-body, including, for. For a constructor this includes, default member initializers or default initialization used to initialize a base or member subobject in the absence of a mem-initializer-id ([class.base.init]). Similarly, for a destructor, this includes any calling of destructors of members and bases by the destructor ([class.dtor]).

@ddvamp
Copy link

ddvamp commented Feb 14, 2025

In my opinion, it is more about location than about actions, i.e. that default member initializers are in the context of function-body, for example, for the purposes of the paragraph below about using incomplete types, or for the purposes of the inlining

@hubert-reinterpretcast
Copy link
Collaborator Author

In my opinion, it is more about location than about actions, i.e. that default member initializers are in the context of function-body, for example, for the purposes of the paragraph below about using incomplete types, or for the purposes of the inlining

If it made sense for "default initialization" (maybe for access checking or point of instantiation), then it makes sense for the destruction.

@jensmaurer
Copy link
Member

CWG2993

@jensmaurer jensmaurer changed the title [dcl.fct.def.general] Informal references to the "body" of a destructor CWG2993 [dcl.fct.def.general] Informal references to the "body" of a destructor Feb 23, 2025
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

No branches or pull requests

3 participants