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

TClass generates dictionary for transient std::unique_ptr member when it shouldn't #13361

Open
1 task done
vepadulano opened this issue Aug 1, 2023 · 2 comments
Open
1 task done
Assignees
Labels

Comments

@vepadulano
Copy link
Member

Check duplicate issues.

  • Checked for duplicates

Description

This issue stems from the problems arisen in #13134 . Among the webgui classes, there is the following layout:

// RFileDialog.hxx
class RFileDialog {
   RBrowserData fBrowsable;            ///<! central browsing element
};

// RBrowserData.hxx
class RBrowserDataCleanup;
class RBrowserData {
   std::unique_ptr<RBrowserDataCleanup> fCleanupHandle;  ///<! cleanup handle for RecursiveRemove
};

// RBrowserData.cxx
class RBrowserDataCleanup : public TObject {};

Which leads to failures in roottest-root-core-execStatusBitsCheck when building with runtime_cxxmodules=OFF:

1548: +Error in <TProtoClass::FindDataMember>: data member with index 0 is not found in class tuple<ROOT::Experimental::RBrowserDataCleanup*,default_delete<ROOT::Experimental::RBrowserDataCleanup> >
1548: +Error in <CreateRealData>: Cannot find data member # 0 of class tuple<ROOT::Experimental::RBrowserDataCleanup*,default_delete<ROOT::Experimental::RBrowserDataCleanup> > for parent ROOT::Experimental::RFileDialog!
1548: +Error in <TProtoClass::FindDataMember>: data member with index 1 is not found in class tuple<ROOT::Experimental::RBrowserDataCleanup*,default_delete<ROOT::Experimental::RBrowserDataCleanup> >
1548: +Error in <CreateRealData>: Cannot find data member # 1 of class tuple<ROOT::Experimental::RBrowserDataCleanup*,default_delete<ROOT::Experimental::RBrowserDataCleanup> > for parent ROOT::Experimental::RFileDialog!

As per the discussion in the linked PR, it seems that TClass is always generating dictionaries for the std::unique_ptr data member, even if it's transient. As things stand, the only "fix" is to move the RBrowserDataCleanup class from the implementation file to the header, and adding ClassDef macro since it inherits from TObject. An alternative workaround was changing std::unique_ptr<RBrowserDataCleanup> to RBrowserDataCleanup *, which is treated transparently in case of a transient member.

Reproducer

  1. Revert the changes in [rbrowser] Move RBrowserDataCleanup into header and LinkDef.h #13134
  2. Run the following macro
    void rbrowserdatacleanup(){
        gSystem->LoadAllLibraries();
        ROOT::Detail::TStatusBitsChecker::CheckAllClasses();
    }

ROOT version

master

Installation method

built from sources

Operating system

linux

Additional context

No response

@pcanal
Copy link
Member

pcanal commented Oct 16, 2023

@linev I can not reproduce this problem. I am guessing this is also linked to the compiler version and possibly C++ library version. Can you be more specific in the environment you are running/using?

@linev
Copy link
Member

linev commented Oct 17, 2023

#13134 fixes an problem by introducing dictionary.

But this should not be necessary.

I working with OpenSUSE Tumbleweed, both with gcc12 and gcc13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants