Bug 22875 – importC: cannot assign const typedef with pointers to non-const one

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-03-11T19:00:46Z
Last change time
2022-09-22T04:34:01Z
Keywords
ImportC, pull, rejects-valid
Assigned to
No Owner
Creator
duser

Comments

Comment #0 by duser — 2022-03-11T19:00:46Z
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
Comment #1 by dlang-bot — 2022-09-22T01:51:36Z
@WalterBright created dlang/dmd pull request #14466 "fix Issue 22875 - importC: cannot assign const typedef with pointers …" fixing this issue: - fix Issue 22875 - importC: cannot assign const typedef with pointers to non-const one https://github.com/dlang/dmd/pull/14466
Comment #2 by dlang-bot — 2022-09-22T04:34:01Z
dlang/dmd pull request #14466 "fix Issue 22875 - importC: cannot assign const typedef with pointers …" was merged into master: - 6c1891a0a8613a228d6b65e1cb21b1541accc4f0 by Walter Bright: fix Issue 22875 - importC: cannot assign const typedef with pointers to non-const one https://github.com/dlang/dmd/pull/14466