wlav / cppyy-backend

23 stars 28 forks source link

typedef cannot be referenced with a enum specifier in function call #9

Closed aaronj0 closed 1 year ago

aaronj0 commented 1 year ago

While running regression tests on typedefed enums on cppyy v2.4.2 built from source, I was running into the following error when the line

import cppyy
        cppyy.cppdef("""\
        namespace TypedefedEnum {
        typedef enum {
            MONDAY    = 0,
            TUESDAY   = 1,
            WEDNESDAY = 2
        } Day;

        int func(const Day day) { return (int)day; }
        }""")

        ns = cppyy.gbl.TypedefedEnum

        assert ns.func(ns.WEDNESDAY) == 2

resulted in the error:

E   cppyy.gbl.std.runtime_error: int TypedefedEnum::func(const TypedefedEnum::Day day) =>
E       runtime_error: failed to resolve function

/home/maximus/cppyy/cppyy/test/test_regression.py:1234: runtime_error
----------------------------------------------- Captured stderr call ------------------------------------------------
input_line_275:6:60: error: typedef 'Day' cannot be referenced with a enum specifier
      new (ret) (int) (((int (&)(const enum TypedefedEnum::Day))TypedefedEnum::func)(*(const enum TypedefedEnum::Day*)args[0]));
                                                           ^
input_line_274:6:11: note: declared here
        } Day;
          ^
wlav commented 1 year ago

Thanks; that's this one: https://github.com/wlav/cppyy/issues/86

Which was fixed locally, but apparently I did not push that commit. Now in repo.

aaronj0 commented 1 year ago

Yep, it passes now, Thanks!!