-
Notifications
You must be signed in to change notification settings - Fork 255
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
Default-define out-of-line dtors for types with fwd-declared unique_ptr members #1088
Conversation
// 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an interesting side-effect of the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good old SMF defaults 😁 Thanks!
@@ -4389,6 +4428,26 @@ struct translation_unit_node | |||
} | |||
}; | |||
|
|||
// Definitions of out-of-line dtors for nodes with unique_ptr members of forward-declared types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@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. |
@hsutter I have rebased this branch on your current main to get all the CI tests to pass. |
Thanks! |
…tr members (hsutter#1088) * Add OOL dtor defs to fix unique_ptr issues * CI Add Clang 18 with C++23 in build workflow
Some of the node types in
parse.h
havestd::unique_ptr
of 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 addedconstexpr
in 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.