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

Enum value not accessible when library with dictionary info is loaded

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • High
    • None
    • 6.22/02
    • Cling
    • None
    • Centos7, gcc8

    Description

      As reported by wlampl, non-scoped enum values are not accessible in the namespace where the enum belongs when loading a dictionary. The value is accessible via the enum name, though.

      For example:

      root [0] gSystem->Load("libRingerSelectorToolsEnumsDict.so")
      (int) 0
      root [1] Ringer::Loose
      ROOT_prompt_1:1:9: error: no member named 'Loose' in namespace 'Ringer'
      Ringer::Loose
      ~~~~~~~~^
      root [2] Ringer::Requirement::Loose
      (Ringer::Requirement) (Ringer::Requirement::Loose) : (unsigned int) 13
      

      However, including the header where the enum is defined does have the expected behaviour:

      root [0] #include "RingerSelectorToolsEnums.h"
      root [1] Ringer::Loose
      (Ringer::Requirement) (Ringer::Requirement::Loose) : (unsigned int) 13
      root [2] Ringer::Requirement::Loose
      (Ringer::Requirement) (Ringer::Requirement::Loose) : (unsigned int) 13
      

      This also affects PyROOT, where the equivalent behaviour can be observed, e.g. :

      import cppyy
      cppyy.load_library('libRingerSelectorToolsEnumsDict')
      from ROOT import Ringer
      Ringer.Requirement.Loose  # ok
      Ringer.Loose   # throws attribute error
      

      The header used above can be accessed here:
      https://gitlab.cern.ch/atlas/athena/-/blob/master/PhysicsAnalysis/RingerSelectorTools/RingerSelectorTools/RingerSelectorToolsEnums.h

      Attachments

        Activity

          People

            axel Axel Naumann
            etejedor Enric Tejedor Saavedra
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: