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

Cling not intepreting using directive

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: 6.20/04
    • Fix Version/s: master, 6.22/04
    • Component/s: Cling, PyROOT
    • Labels:
      None
    • Environment:

      Fedora 31

      gcc 9.3.1

      clang 9.0.1

    • Development:

      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

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

              Dates

              Created:
              Updated:
              Resolved: