On Fri, 13 Jul 2018 at 04:05, RazvanN via Digitalmars-d
<digitalmars-d@puremagic.com> wrote:
>
> > [...]
>
> The problem with this approach is that some copy constructors
> will also be used as assignment operators while others will not,
> but with good error messages it could be handled (error on line
> `f = d` : opAssign not specified and the copy constructor is not
> suitable for assignments because it modifies immutable field `b`).
>
> What are your opinions on this?

Right; I figure, if the struct contains members that can't be copied,
then the struct is defined in such a way that it simply can't be
copied.
I mean, if the copy constructor can't be used to copy the thing, then
is copying the struct valid at all?

What would a valid copy operation on a struct with an immutable field
do? Either way, in that case, a good error should inform the user they
need to write an explicit opAssign.

Reply via email to