[Issue 22875] New: importC: can't assign const typedef with pointers to non-const one
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Mar 11 19:00:46 UTC 2022
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 at puremagic.com
Reporter: duser at 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
--
More information about the Digitalmars-d-bugs
mailing list