Default-define out-of-line dtors for types with fwd-declared unique_ptr members#1088
Merged
hsutter merged 2 commits intohsutter:mainfrom Jun 22, 2024
Merged
Default-define out-of-line dtors for types with fwd-declared unique_ptr members#1088hsutter merged 2 commits intohsutter:mainfrom
hsutter merged 2 commits intohsutter:mainfrom
Conversation
jarzec
commented
May 29, 2024
| // Because a forward-declared type is used in a std::unique_ptr as a member an out-of-line dtor is necessary | ||
| // Because of the OOL dtor together with the fact that the copy ctor+operator are deleted | ||
| // the move ctor+operator need to be explicitly defaulted | ||
| // As a result the default constructor also needs to be explicitly defaulted |
Contributor
Author
There was a problem hiding this comment.
This is an interesting side-effect of the changes.
jarzec
commented
May 29, 2024
| } | ||
| }; | ||
|
|
||
| // Definitions of out-of-line dtors for nodes with unique_ptr members of forward-declared types |
Contributor
Author
There was a problem hiding this comment.
I've decided to add the deferred dtor definitions here, at the point where (to the best of my knowledge) all node types are already defined.
Contributor
Author
|
@hsutter The PR with the discussed updates is ready. For some reason, when I created it GitHub runners had a bad time and some testes were cancelled/skipped. The changes are OK as you can see from the tests of the same commit in my own fork. You can also rerun the failed steps ones manually for the PR in the Actions section. |
Contributor
Author
|
@hsutter I have rebased this branch on your current main to get all the CI tests to pass. |
Owner
|
Thanks! |
MarekKnapek
pushed a commit
to MarekKnapek/cppfront
that referenced
this pull request
Jul 4, 2024
…tr members (hsutter#1088) * Add OOL dtor defs to fix unique_ptr issues * CI Add Clang 18 with C++23 in build workflow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some of the node types in
parse.hhavestd::unique_ptrof forward-declared types as members without having destructors deferred to when the pointed-to types are defined. If the default deleter is used this is IFNDR. Despite that, all compilers seem to have been compiling such code without problem. Only recently Clang >=15 with C++23 enabled started to raise errors in such situations. This is likely due to the addedconstexprin the default deleter, which seemed to have change changed implementation decisions.This PR adds out-of-line defaulted destructors for such cases to fix the possible compiler errors. It also enables a build test for Clang 18 with C++23 to ensure the solution works.