cat > bug.d << CODE
struct S
{
this(inout Correct) inout
{
}
}
struct Correct {}
struct Wrong {}
S bug()
{
return S(Wrong());
}
CODE
dmd -c bug
----
bug.d(13): Error: inout method bug.S.this is not callable using a mutable object
----
The error should point out that the wrong type is passed, not that it's mutable.
Comment #1 by dlang-bugzilla — 2017-06-18T07:59:38Z
This seems to be a regression.
2.061:
test.d(13): Error: constructor test.S.this (inout(Correct) _param_0) inout is not callable using argument types (Wrong)
test.d(13): Error: cannot implicitly convert expression (Wrong()) of type Wrong to Correct
2.062:
test.d(13): Error: inout method test.S.this is not callable using a mutable object
test.d(13): Error: cannot implicitly convert expression (Wrong()) of type Wrong to Correct
2.063:
test.d(13): Error: inout method test.S.this is not callable using a mutable object
The 2.062 -> 2.063 change was caused by https://github.com/dlang/dmd/pull/1842. Not sure about the first one.
Comment #2 by razvan.nitu1305 — 2018-12-18T14:40:59Z