Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-10800

TClass::GetListOfAllPublicMethods() lists deleted copy constructor of std::unique_ptr

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Medium
    • Resolution: Fixed
    • master
    • 6.24/00, 6.20/08, 6.22/02
    • None
    • None
    • CVMFS dev3/latest

    Description

      The following snippet:

      TClass* cl = TClass::GetClass("std::unique_ptr<int>");
      auto* pm = cl->GetListOfAllPublicMethods();
      for (int i = 0; i < pm->GetSize(); ++i) {
          TFunction* f = (TFunction*)pm->At(i);
          if (f->ExtraProperty() & kIsConstructor)
              std::cerr << f->GetSignature() << std::endl;
      }
      

      Outputs:

      ()
      (unique_ptr<int,default_delete<int> >::pointer __p)
      (unique_ptr<int,default_delete<int> >::pointer __p, conditional<false,default_delete<int>,const default_delete<int>&>::type __d)
      (unique_ptr<int,default_delete<int> >::pointer __p, remove_reference<default_delete<int> >::type&& __d)
      (nullptr_t)
      (unique_ptr<int,default_delete<int> >&& __u)
      (const unique_ptr<int,default_delete<int> >&)
      

      Among which the signature `(const unique_ptr<int,default_delete<int> >&)` refers to the deleted copy constructor of `std::unique_ptr`. This in turn becomes an issue in PyROOT when jitting calls to a function that takes `unique_ptr` as argument, since at some point that also calls the deleted copy constructor. Here a reproducer

      import ROOT
      ROOT.gInterpreter.ProcessLine('''
      std::unique_ptr<int> returnptr(std::unique_ptr<int> a){
          return a;
      }''')
       
      uptrin = ROOT.std.make_unique["int"]()
      uptrout = ROOT.returnptr(ROOT.std.move(uptrin))

      Attachments

        Activity

          People

            axel Axel Naumann
            vpadulan Vincenzo Eduardo Padulano
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: