[fpc-devel] Regarding CheckIn #23944

kyan alfasud.ti at gmail.com
Thu Mar 28 17:48:12 CET 2013


"Don't allow "static" for class operators or normal methods (except in objects)"

http://svn.freepascal.org/cgi-bin/viewvc.cgi?view=revision&revision=23944

Does this mean that the following code:

{$mode=Delphi}

type
  TRec = record
    ...
    class function Empty: TRec; static;
    class operator Equal(A, B: TRec): Boolean; inline; static;
  end;

will not compile?

Mind you Sven, in Delphi XE the "static" directive is allowed for
record "class" operators although I don't know if it actually makes a
difference to emitted code -I would suspect not since there is no
"class pointer" to pass to the method as a first hidden argument,
records do not support inheritance and have no VMT. For the same
reason "class" functions of records are *required* to be declared as
"static".

I believe that you made this change for the same reason, i.e. you
imply that class functions and operators of records are inherently
static, but this breaks Delphi compatibility especially for class
functions.

Constantine.



More information about the fpc-devel mailing list