[rootcling] Remove check for unique_ptr members#20389
Merged
hahnjo merged 2 commits intoroot-project:masterfrom Nov 12, 2025
Merged
[rootcling] Remove check for unique_ptr members#20389hahnjo merged 2 commits intoroot-project:masterfrom
unique_ptr members#20389hahnjo merged 2 commits intoroot-project:masterfrom
Conversation
Since llvm/llvm-project@f5e687d libc++ implements _LIBCPP_COMPRESSED_PAIR with an anonymous struct (a Clang extension). This results in unique_ptr having a single FieldDecl with an empty name that does not appear as a data member in TClass. Instead, the AST has multiple IndirectFieldDecl's that "refer" into the anonymous struct. In ROOT, we now have two options: We could support anonymous structs, either by allowing data members with empty names or by adding all indirect field declarations as members. However, I would argue that we actually do NOT want to support this extension for IO classes. Instead remove the (questionable) check in rootcling that verifies the number of data members in unique_ptr.
Since the previous commit, IsUnsupportedUniquePointer does not check the number of data members anymore.
pcanal
approved these changes
Nov 12, 2025
Member
pcanal
left a comment
There was a problem hiding this comment.
Thanks for the investigation.
We could support anonymous structs, either by allowing data members with empty names or by adding all indirect field declarations as members. However, I would argue that we actually do NOT want to support this extension for IO classes.
We should probably (also) document/memorialize that we do not support this case (i.e. it 'could' affect some user code).
Side note that the real/essential check is already done by IsUniquePtrOffsetZero (i.e. support for unique_ptr requires that it is (strictly) using the same memory layout as a raw pointer).
Test Results 22 files 22 suites 3d 23h 23m 12s ⏱️ Results for commit 10fa16d. |
This was referenced Nov 12, 2025
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.
Since llvm/llvm-project@f5e687d libc++ implements
_LIBCPP_COMPRESSED_PAIRwith an anonymous struct (a Clang extension). This results inunique_ptrhaving a singleFieldDeclwith an empty name that does not appear as a data member inTClass. Instead, the AST has multipleIndirectFieldDecls that "refer" into the anonymous struct.In ROOT, we now have two options: We could support anonymous structs, either by allowing data members with empty names or by adding all indirect field declarations as members. However, I would argue that we actually do NOT want to support this extension for IO classes. Instead remove the (questionable) check in
rootclingthat verifies the number of data members inunique_ptr.Closes #20377