On Tuesday, 14 November 2023 at 13:58:17 UTC, Paul Backus wrote:
On Tuesday, 14 November 2023 at 13:41:32 UTC, Steven Schveighoffer wrote:
```
Error: copy constructor `testinoutctor.S1.this(ref const(S1) s) const` is not callable using argument types `(const(S1))`
```

I'm not sure what this means. There shouldn't be a copy being made here, as the thing is already const. I don't understand this error, and it looks like a bug to me.

The error is saying that the copy constructor expects a `const` `this` argument, but you're passing a mutable `this` argument.

Thanks for explaining, it's a confusing error.

The error when the constructor is changed to be immutable is:
```
Error: `immutable` method `immutable_ctor.S1.this` is not callable using a mutable object
```
(I've made a fix to say constructor instead of method for that.)
Now I've made a fix to produce a similar error for const:
https://issues.dlang.org/show_bug.cgi?id=24248

Reply via email to