2010/12/29 David Emerson <dle...@angelbase.com>:
> On Wed 29 Dec 2010, Honza wrote:
>> IIRC you don't have to.
>
> well... I do have to. I get "can't determine which overloaded function to 
> call"
> because I have a lot of similar-looking functions and := operators
You're right, I verified it just now. I didn't remembered it correctly.

FYI, bellow is the verification example used, later modified to
compile successfully with trunk FPC. Introduction of the ':='
operators for T1 and T2 enabled the '+' operator commutativity.

program project1;

{$mode objfpc}{$H+}

type

  T1 = record
    Dummy: Boolean;
    Value: Integer;
  end;

  T2 = record
    Dummy: String;
    Value: Integer;
  end;

operator +(A: T1; B: T2): Integer;
begin
  Result := A.Value + B.Value;
end;

operator :=(X: T1): T2;
begin
  Result.Value := X.Value
end;

operator :=(X: T2): T1;
begin
  Result.Value := X.Value
end;

var
  V1: T1;
  V2: T2;

begin
  V1.Value := 2;
  V2.Value := 3;
  Writeln(V1 + V2, ' ', V2 + V1);
end.

-- 
bflm
freepascal-bits.blogspot.com
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to