[fpc-devel] All constant operators

Ryan Joseph ryan at thealchemistguild.com
Mon Mar 18 16:23:08 CET 2019


Can anyone help complete a list of all possible operators that could be used with constants in a record? I keep finding bugs with new operators so I need an exhaustive list for testing. The goal is complete the parser phase for the generic without getting errors so that only when it’s specialized you get specific errors if the wrong type was used.

Here’s what I have so far in my test:

type
  generic TUnaryOp<const I> = record
    const
      d0 = -I;
      d1 = +I;
      d2 = not I;
  end;

type
  generic TBinaryOp<const I> = record
    const
      d0 = I + I;
      d1 = I - I; 
      d2 = I * I; 
      d3 = I / I; 
      d4 = I div I; 
      d5 = I mod I; 
      d6 = I and I;
      d7 = I or I;
  end;

In addition to this are there other places where constants could be used in a record? I’m only aware of default values for function parameters.

type
  generic TRoutines<const I> = record
    procedure DoThis(param: integer = I);
  end;


Regards,
	Ryan Joseph




More information about the fpc-devel mailing list