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

Cling not intepreting using directive

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Medium
    • Resolution: Fixed
    • 6.20/04
    • master, 6.22/04
    • Cling, PyROOT
    • None
    • Fedora 31

      gcc 9.3.1

      clang 9.0.1

    Description

      This works as expected:

      #include <TH1F.h>
       
      class MyTH1F : public TH1F
      {
      public:
         using TH1F::TH1F;
      };
       
      int main()
      {
        MyTH1F h("name", "title", 100, 0, 100);
      }
      

      if I remove the using directive I get:

      a.cpp:11:40: error: no matching function for call to 'MyTH1F::MyTH1F(const char [5], const char [6], int, int, int)'
         11 |   MyTH1F h("name", "title", 100, 0, 100);
            |                                        ^
      a.cpp:3:7: note: candidate: 'MyTH1F::MyTH1F()'
          3 | class MyTH1F : public TH1F
            |       ^~~~~~
      a.cpp:3:7: note:   candidate expects 0 arguments, 5 provided
      a.cpp:3:7: note: candidate: 'MyTH1F::MyTH1F(const MyTH1F&)'
      a.cpp:3:7: note:   candidate expects 1 argument, 5 provided
      a.cpp:3:7: note: candidate: 'MyTH1F::MyTH1F(MyTH1F&&)'
      a.cpp:3:7: note:   candidate expects 1 argument, 5 provided
      
      

      as expected.

       

      The problem is if I do this:

      import ROOT
       
      ROOT.gInterpreter.Declare(
      """
      class MyTH1F : public TH1F
      {
      public:
         using TH1F::TH1F;
      };
      """)
       
      h = ROOT.MyTH1F("name", "title", 100, 0, 100)
      

      I get the same error as if the using directive were not present

      TypeError: none of the 3 overloaded methods succeeded. Full details:
        MyTH1F::MyTH1F() =>
          takes at most 0 arguments (5 given)
        MyTH1F::MyTH1F(const MyTH1F&) =>
          takes at most 1 arguments (5 given)
        MyTH1F::MyTH1F(MyTH1F&&) =>
          takes at most 1 arguments (5 given)
      

      Attachments

        Activity

          People

            etejedor Enric Tejedor Saavedra
            turra Ruggero Turra
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: