Open guitargeek opened 5 months ago
The type Track::Type
is actually found as an enum, but it's seen as disjoint from the type Enum
, not an alias of it. I'd figure it should resolve as an alias, to make Python's is
work. That's a failure of ROOT/meta's type resolution.
However, even if not seen as an alias, the lookup should have worked if a
if the enum was properly reflected. Looks like it's not:
import cppyy
cppyy.cppdef("enum Enum { a,b,c };")
cppyy.cppdef("struct Track { using Type = Enum; };")
print("is enum:", cppyy.gbl.gInterpreter.ClassInfo_IsEnum("Track::Type"))
c = cppyy.gbl.CppyyLegacy.TClass.GetClass("Track")
e = c.GetListOfEnums(1).FindObject("Type")
print("is valid:", not not e)
which yields:
is enum: True
is valid: False
In general, ROOT/meta lacks support for using
and friend
.
Thank you so much for giving some context @wlav! That helped me to understand where the root cause is, maybe I can fix it at some point.
When defining aliases for an enum, it is not recognized as the right type by cppyy.
Reproducer:
The output is:
In case this is a more complicated problem, any advice on how I can contribute to support this is greatly appreciated!
Originally reported in the ROOT issue tracker: https://github.com/root-project/root/issues/9246