[Issue 23926] ImportC: D can’t pass pointer to const struct to C function declared taking pointer to const struct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 23 05:25:53 UTC 2023


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

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla at digitalmars.com
         Resolution|---                         |LATER

--- Comment #3 from Walter Bright <bugzilla at digitalmars.com> ---
You're right, it's about the non-transitivity of C const. D's choices are:

1. compile correct C code, and also compile some incorrect C code

2. not compile some correct C code, not compile incorrect C code

3. implement non-transitive const in D

(1) is the most pragmatic choice. Maybe eventually we can do (3), but it's a
low priority. Note that any hand-translated C code to D has the same issue.

Improving the error message also would be rather clumsy. I wish I had better
news on that.

BTW, `const struct Foo*` in C looks like const(Foo)* in D, while `const Foo*`
in D is actually `const(Foo*)`.

I'm going to resolve this as "LATER".

--


More information about the Digitalmars-d-bugs mailing list