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

[class.dtor]/example-1 is illegal #5790

Closed
blackteahamburger opened this issue Aug 24, 2022 · 1 comment
Closed

[class.dtor]/example-1 is illegal #5790

blackteahamburger opened this issue Aug 24, 2022 · 1 comment

Comments

@blackteahamburger
Copy link
Contributor

blackteahamburger commented Aug 24, 2022

It makes multiple B's and D's destructor calls to D_object directly and indirectly via B_ptr, which is illegal according to [class.dtor]/19.

It's also illegal according to [basic.life]/9. Because D's destructor is non-trivial and a new D object is not constructed in place.

@jensmaurer
Copy link
Member

The example never actually calls f, so this is not a problem. The purpose of the example is to show the meaning of different syntactic forms for invoking the destructor, as evidenced by the comments, not to present a program without undefined behavior.

@jensmaurer jensmaurer closed this as not planned Won't fix, can't repro, duplicate, stale Aug 24, 2022
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

2 participants