[CI] Fix clang-18 C++23 build of cppfront#1187
Merged
hsutter merged 3 commits intohsutter:mainfrom Jul 30, 2024
Merged
Conversation
added 3 commits
July 30, 2024 11:18
The `declaration_node` definition for the `unique_ptr` member is not yet visible if the ctor is written inline.
Owner
|
Thanks! But this is only needed for the destructor, right? Not the constructor? |
Contributor
Author
|
It's needed for both in this case. Here's a repro showing the ctor issue: #include <memory>
struct MyType;
struct Owner
{
std::unique_ptr<MyType> mine_;
Owner() {}
};
struct MyType
{
int value = 0;
};
int main()
{
Owner o;
}Relevant hint from the error: I think it needs to be able to destruct the Fixed version: #include <memory>
struct MyType;
struct Owner
{
std::unique_ptr<MyType> mine_;
Owner();
};
struct MyType
{
int value = 0;
};
Owner::Owner() {}
int main()
{
Owner o;
} |
Owner
That reasoning makes sense to me. Then I wondered, 'why do other types in parse.h only have to put the dtor out of line for this?' I looked, and I think the answer is because those types don't have a user-declared constructor... bingo. So I think this makes sense. Thanks! |
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 constructors and destructors have to be defaulted/written out-of-line in order to compile successfully with clang 18 in C++23 mode, due to forward declaring types and using them with
unique_ptr.Fixes this build error.
Similar issue as solved by this previous PR: #1088
EDIT: This only fixes the CI build of cppfront; I'll create a separate PR to update the regression tests.