October 25, 2023 [Issue 24201] New: ImportC: enum in .di file should have members un-namespaced. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24201 Issue ID: 24201 Summary: ImportC: enum in .di file should have members un-namespaced. Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: ImportC Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: dave287091@gmail.com If you have a C file like: // enum.c enum Foo { FOO_0, FOO_1, FOO_2, }; which you convert to a .di file, it will contain (macro enums removed for brevity): extern (C) { enum Foo { FOO_0, FOO_1, FOO_2, } } Which is an incorrect translation. The imported C file will allow you to access the members of Foo without name spacing, like `FOO_0`, while the .di file will require you to write `Foo.FOO_0`. The enum members should be aliased into the module scope so that both imports function the same way. That is important as you might generate a .di file so your editor auto-complete works, but you want to compile with the actual .c file in case the code you are compiling against changes. -- |
Copyright © 1999-2021 by the D Language Foundation