struct opAssign in spec

Ali Çehreli acehreli at yahoo.com
Wed Dec 19 22:56:38 PST 2012


On 12/19/2012 09:57 PM, Red wrote:
 > Looking at the Kindle spec

Here as well:

   http://dlang.org/struct.html#AssignOverload

 > there appears to be an error in the section
 > for structs called Assignment Overload.
 >
 > S* opAssign (ref const S s) {
 > a = s.a;

Of course, there is also the return statement:

     return this;

 > }
 >
 > gives an error:
 > Error: cannot implicitly convert expression (this) of type S to S*
 >
 > S opAssign (ref const S s) {
 >
 > does compile.

You are right. The documentation is wrong.

Ali



More information about the Digitalmars-d-learn mailing list