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

RazvanN <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #4 from RazvanN <[email protected]> ---
opAssign for a struct is used only if it is defined for that particular struct.
If the struct defines a postblit, but not an opAssign the compiler steps in and
generates an opAssign which basically calls the postblit. The whole point of
this design is to avoid declaring both a copy constructor and a postblit when
the 2 are identical.

In this particular case, the compiler generates a postblit for T and as T does
not define an opAssign, it will generate one. This is the intended behavior.
If you want to make struct T uncopyable, you should disable its postblit 

>This isn't strictly *wrong*, its just a pretty dirty way of doing things, and 
>I'm pretty sure it's inefficient, and it definitly defeats the purpose of 
>having an opAssign to begin with.

It does not defeat the purpose of opAssign. Postblit and opAssign are 2
different things. Postblit is used for initialization and opAssign for copies,
however it is a feature that the compiler generates an opAssign from the
postblit when the user does not define one.

I suggest closing as wontfix.

--

Reply via email to