[PySide] Cannot pass enum by value

John Cummings jcummings2 at users.sf.net
Wed May 30 18:33:54 CEST 2012

I uncovered a bug with the latest Shiboken when passing an enum by reference. 
Like Nathan, I have a bug report ready to go when the system comes back up.

In previous versions, you could pass an enum by reference to a method like so:

class Val
enum ValEnum { One, Other };
ValEnum oneOrTheOtherEnumValue(ValEnum& enumValue) { return enumValue == One ? 
Other : One; }

You get compilation errors with version 1.1.1 and with HEAD. The generated code 
is trying to use a pointer instead of reference. Previous version of Shiboken  
worked just fine (specifically, 1.0.7 worked, I'm not sure about other versions 
until 1.1.1).

Unlike Nathan, I don't have a patch ready. The workaround is obviously to pass 
an enum by value not by reference (which is admittedly a bit overkill anyway). 
If someone knows of a better solution, I'm willing to try it.

John Cummings

More information about the PySide mailing list