<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Ryan Joseph <<a href="mailto:genericptr@gmail.com">genericptr@gmail.com</a>> schrieb am Mo., 10. Juni 2019, 16:26:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
> On Jun 10, 2019, at 9:31 AM, Sven Barth via fpc-devel <<a href="mailto:fpc-devel@lists.freepascal.org" target="_blank" rel="noreferrer">fpc-devel@lists.freepascal.org</a>> wrote:<br>
> <br>
> The +-operator is not defined internally thus it is allowed to be overloaded. (is it really that hard to understand? If you can use an operator in code without declaring an operator overload then this operator is internal and not allowed to be overloaded). <br>
> <br>
<br>
I get what you mean but I had no idea := with the destination variable was an operator.</blockquote></div></div><div dir="auto"><br></div><div dir="auto">There exist only two assignment operators, namely "Implicit" (aka := in mode ObjFPC) and "Explicit" both taking a single argument. Introducing a binary operator does not change that the operator is forbidden for classes. </div><div dir="auto"></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I just tried this right now and I didn’t an error but it was indeed not overloaded and never got called. A bug?<br>
<br>
operator := (left, right: TObject): TObject;<br>
begin<br>
writeln('custom :=');<br>
end;<br>
<br>
var<br>
c: TObject;<br>
begin<br>
c := TObject.Create;<br>
end.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Did you try with trunk? Cause I fixed something related to that a few weeks ago. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>