digitalmars.D.bugs - [Issue 23662] New: ImportC bad handling of enum arguments for a
- d-bugmail puremagic.com (43/44) Jan 30 2023 https://issues.dlang.org/show_bug.cgi?id=23662
https://issues.dlang.org/show_bug.cgi?id=23662 Issue ID: 23662 Summary: ImportC bad handling of enum arguments for a function Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: bugzilla digitalmars.comFrom Dmytro Katyukha <firemage.dima gmail.com>:It seems that ImportC does not allow to pass enums declared with typedef but without tag to function that receives enum as one of argument ```c // testlib.c typedef enum /*enum_test_1_t*/ { E_TEST_1_ITEM_1 = 1, E_TEST_1_ITEM_2, } enum_test_1_t; int some_func(enum_test_1_t val) { return val; } ``` ```d //test.d import testlib; void main(string[] args) { enum_test_1_t val1 = E_TEST_1_ITEM_1; some_func(E_TEST_1_ITEM_1); } ``` ``` dmd test.d testlib.c test.d(6): Error: function `testlib.some_func(__tag2 val)` is not callable using argument types `(__anonymous)` test.d(6): cannot pass argument `E_TEST_1_ITEM_1` of type `__anonymous` to parameter `__tag2 val` ``` --
Jan 30 2023