https://issues.dlang.org/show_bug.cgi?id=20876

--- Comment #6 from kinke <ki...@gmx.net> ---
(In reply to RazvanN from comment #4)
> So, to conclude, by the current language rules the error is correct.
> 
> The fix in this situation would be to annotate the copy constructor of Bar
> with `inout`: this(ref inout(Bar)) inout . That will make the code to
> compile.
> 
> But I agree that the error could be improved.

Thx for the explanation. - I think this really needs some work. So currently,
this fails for both

struct Bar { this(ref Bar) {} }
struct Bar { this(const ref Bar) {} }

because the compiler tries to generate an inout copy ctor for

struct Foo { Bar _bar; }

Instead of disabling it completely if that fails, I think it should try to fall
back to a mutable or const copy ctor, propagating the limitations of its
fields.

--

Reply via email to