wlav / cppyy

Other
400 stars 41 forks source link

[regression] enum as argument broken in 2.4.0 #86

Closed Verma-Rajat closed 10 months ago

Verma-Rajat commented 2 years ago

Below code works fine with 2.3.0:

import cppyy
cppyy.cppdef("""
typedef enum {
    MONDAY,
    TUESDAY,
    WEDNESDAY
} Day;

void func(const Day day)
{
std::cout << day << std::endl;
}
""")
from cppyy.gbl import Day, WEDNESDAY, func
func(WEDNESDAY)

However, on 2.4.0, it throws below error:

$ python cppyy_enum.py 
input_line_19:5:26: error: typedef 'Day' cannot be referenced with a enum specifier
   ((void (&)(const enum Day))func)(*(const enum Day*)args[0]);
                         ^
input_line_18:6:3: note: declared here
} Day;
  ^
input_line_19:5:50: error: typedef 'Day' cannot be referenced with a enum specifier
   ((void (&)(const enum Day))func)(*(const enum Day*)args[0]);
                                                 ^
input_line_18:6:3: note: declared here
} Day;
wlav commented 2 years ago

Thanks, I can reproduce. Most probably caused by this: https://github.com/wlav/cppyy-backend/commit/f0d83800c0ee2214c21d0616a14c3b492d9dbe14

wlav commented 10 months ago

This got fixed somewhere along the way (runs fine with 3.1.1). Closing ...