[fpc-pascal] Operator overloading broken in 1.9.6?

Vinzent Hoefler JeLlyFish.software at gmx.net
Mon Jan 3 17:05:29 CET 2005


On Monday 03 January 2005 13:33, Peter Vreman wrote:

> > operator * (const C : Char; const Len : byte) s : String;
[doesn't work anymore]
>
> 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.

Hmm, guess I just have to accept this. ;-) This routine was just for fun 
anyway..., nothing serious.

Ok, after trying to compile some more (hey, you guys invented a lot of 
new warnings, ;-) thank you), here's my next problem, I can't 
understand:

-- 8< -- snip --
program
   Bug;

{ use a structured type used to keep the namings clean }
type
   tLoopParm =
   record
      Min,
      Max,
      Cur : word;
   end {tLoopParm};

var
   One,
   Two,
   Three,
   Four : tLoopParm;

begin
   One.Min := 42;
   One.Max := 42;

   for One.Cur := One.Min to One.Max do
   begin
      Two.Min := 42;
      Two.Max := 42;

      for Two.Cur := Two.Min to Two.Max do // <- line 28
      begin
         Three.Min := 42;
         Three.Max := 42;

         for Three.Cur := Three.Min to Three.Max do // <- line 33
         begin
            Four.Min := 42;
            Four.Max := 42;

            for Four.Cur := Four.Min to Four.Max do // <- line 38
            begin
               // code
            end {for Four};
         end {for Three};
      end {for Two};
   end {for One};
end {Bug}.

-- -- --

Target OS: Linux for i386
Compiling bug.pas
bug.pas(28,30) Error: Illegal assignment to for-loop variable "Cur"
bug.pas(33,37) Error: Illegal assignment to for-loop variable "Cur"
bug.pas(38,38) Error: Illegal assignment to for-loop variable "Cur"
bug.pas(45,10) Fatal: There were 3 errors compiling module, stopping

-- 8< -- snip --

This doesn't make sense, does it?

As mentioned before, all this code compiled fine with fpc-1.0.10 (Linux, 
DOS & Windows targets).


Vinzent.





More information about the fpc-pascal mailing list