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.

It's confusing because (a) the `this` argument is hidden and doesn't appear in the parameter list, and (b) there's no explicit "mutable" qualifier. So when it prints out the list of argument types that were actually passed, the `this` argument (`S1 ss1`) gets printed as an empty string.

It's easier to see if you compare the actual and expected argument lists side-by-side

    Expected: (ref const(S1) s) const
    Actual:   (    const(S1)  )
                                ^^^^^
                     Mismatched 'this' argument

Reply via email to