digitalmars.D.bugs - [Issue 22875] New: importC: can't assign const typedef with pointers
- d-bugmail puremagic.com (37/37) Mar 11 2022 https://issues.dlang.org/show_bug.cgi?id=22875
https://issues.dlang.org/show_bug.cgi?id=22875 Issue ID: 22875 Summary: importC: can't assign const typedef with pointers to non-const one Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: duser neet.fi typedef union value_u { void *p; } value_t; typedef struct data_s { void *p; } data_t; void fn() { value_t a; const value_t b; // Error: cannot implicitly convert expression `b` of type `const(value_u)` to `value_u` a = b; data_t aa; const data_t bb; // Error: cannot implicitly convert expression `bb` of type `const(data_s)` to `data_s` aa = bb; } - if "void *p" is made a non-pointer type, the error disappears - if the const variables are changed to use the original name instead of the typedef, the error disappears --
Mar 11 2022