> Hi,
>
> just installed 1.9.6 to see if any of our current code will break and
> unfortunately I wasn't disappointed. ;-)
>
> stripped down code:
>
> -- 8< -- snip --
> unit
>    StrTools;
>
> interface
>
> operator * (const C : Char; const Len : byte) s : String;
>
> implementation
>
> operator * (const C : Char; const Len : byte) s : string;
> var
>    i : byte;
> begin
>    s := '';
>
>    for i := 1 to Len do
>       s := s + C;
> end {"*"};
>
> end {StrTools}.
> -- 8< -- snip --
>
> This compiled fine with 1.0.10, but 1.9.6 now bails out with "Error:
> Impossible operator overload" as early as at the line where the
> operator is declared.
>
> Is this a bug? A feature? Or just me being stupid?

There must be at least one complex type record/string/array involved. Your
example is only using 2 ordinal types. At the time that the expression is
parsed the result is not known so the complex string result has no
influence.

Example of things that are ambigious:

procedure p1(b:byte);
procedure p1(s:string);

p1(char*byte);

This can be a missing type cast and therefor the compiler shall give an
error. Also you can see here that the result of byte*char can't be known
yet at the time it is parsed. Because the type of the argument needed by
p1() can be either string or byte.




_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to