importC reflection drop const attribute bugs

Dakota dakota at gmail.com
Wed Feb 28 05:00:32 UTC 2024


On Tuesday, 27 February 2024 at 12:27:01 UTC, Dakota wrote:
>
> I dont know how to find it by DustMite, take 5 hours to find 
> this bugs.  (find from a 700KB c header files)


This test case more clear:

test2i.c
```c
typedef struct Message Message;
int tryEncode(const Message* msg);
```


test2d.d

```d
import test2i;
void test1(){
	const Message* m;
	tryEncode(m);
}

```

```sh
dmd test2d.d -betterC -c
test2d.d(4): Error: function `tryEncode` is not callable using 
argument types `(const(Message*))`
test2d.d(4):        cannot pass argument `m` of type 
`const(Message*)` to parameter `Message* msg`
test2i.c(2):        `test2i.tryEncode(Message* msg)` declared here
```


More information about the Digitalmars-d mailing list