[Issue 24158] ImportC: enums created from string literal #defines don’t implicitly convert to const(char)* in D.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 20 01:59:39 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=24158

--- Comment #5 from Walter Bright <bugzilla at digitalmars.com> ---
A .di file has D semantics, even if it was generated from a .c file. Hence, it
will always be imperfect, subject to the impedance mismatches between D and C.

If the C semantics of a string literal were changed to match D, then they would
no longer work for C files.

If a special case was added to D implicit conversion rules so a char[2] was
implicitly converted to const(char)*, then who knows what D code will break
that relied on overloading differences between them.

I cannot think of a solution that resolves this.

--


More information about the Digitalmars-d-bugs mailing list