[Issue 22734] New: importC: typedef’d anonymous enum’s members not available when used from D.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Feb 3 22:25:49 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=22734
Issue ID: 22734
Summary: importC: typedef’d anonymous enum’s members not
available when used from D.
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: dave287091 at gmail.com
With the following C file:
// enu.c
enum E_a {
A,
};
enum {
B,
};
typedef enum {
C,
} E_c;
typedef enum E_d {
D,
} E_d;
int a = A;
int b = B;
int c = C;
int d = D;
Which is then imported by the following D file:
// use_enu.d
import enu;
auto d_a = A;
auto d_b = B;
auto d_c = C;
auto d_d = D;
You get the following errors:
enu.c(19): Error: undefined identifier `C`
use_enu.d(6): Error: undefined identifier `C`
What is odd though is that if you compile enu.c directly:
dmd enu.c -c
You get no error, it is when you compile a D file
dmd use_enu.d -c
that you get the above errors.
--
More information about the Digitalmars-d-bugs
mailing list