C++ method with enum as argument

Hi Wim,

i just installed root 5.18. now i have the following problem (was okay before with root 5.17.08 )

when a c++ method has an enum type as argument, it’s not called from inside pyroot ?!?

consider this testEnum.C

#include

enum myEnum { cow = 0, bird, fish };

void testEnum( myEnum e)
{
std::cout << "enum = " << e << std::endl;
}

void testEnum2( int e)
{
std::cout << "int = " << e << std::endl;
}

Now, i use both methods in pyroot:

PyROOT> gROOT.LoadMacro(“testEnum.C+”)
Info in TUnixSystem::ACLiC: creating shared library /home/eifert/groups/catsusy/StatTools/test/./testEnum_C.so
0
PyROOT> testEnum(fish)
PyROOT> testEnum2(fish)
int = 2

The method with an enum as argument does not do anything …
when i switch back from root 5.18.00 to 5.17.08, both methods work !

any idea ?

Thanks,
Till

Till,

this is caused by a recent change in CINT. Thanks for reporting, now being worked on …

Cheers,
Wim

Wim, I have submitted a patch extending the behavior of G__param_match() in cint to perform additional checks for enums so that the enum tags are compared. Because cint has the nasty habit of pretending that enums are ints additional checks are necessary. Fortunately the enum-ness is hidden but not erased, so a real check for equality is still possible. The patch will probably end up in the root trunk later today or tomorrow.

– Paul Russo

Hi Wim,

The patch is in the trunk. Once you verify it improves things (or if you it is better for you to test), I will also upload it on the patch branch for 5.18

Cheers,
Philippe

Philippe,

yes, Till may want to verify but this works fine for me. Thanks!

Cheers,
Wim

Hello,

Is it possible to apply this patch to one’s own ROOT installation ?
I have a 5.18 which I compiled myself and I really need this bug fixed…

Cheers,

P.A.

Hi,

This has been fixed on the SVN patch branch for 5-18/00. Please see root.cern.ch/twiki/bin/view/ROOT/PatchesV5-18-00 for information on how you can download it.

Alternatively you can download the patch itself at
root.cern.ch/viewcvs/branches/v5 … hrev=22038

Cheers,
Philippe