May 18, 2023
https://issues.dlang.org/show_bug.cgi?id=23926

          Issue ID: 23926
           Summary: ImportC: D can’t pass pointer to const struct to C
                    function declared taking pointer to const struct
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: dave287091@gmail.com

// foo.c
struct Foo;
void foo(const struct Foo* x);

// usefoo.d
import foo;

void bar(const Foo* x){
    //Error: function `foo.foo(Foo* x)` is not callable using argument types
`(const(Foo*))`
    //       cannot pass argument `x` of type `const(Foo)*` to parameter `Foo*
x`
    foo.foo(x);
}


I believe const was stripped so that C function bodies could be compiled, but it should be preserved for the purpose of calling from D.

--