Cannot cast static class procedure to a variable without class prefix in objfpc mode
Original Reporter info from Mantis: kluug.net @onpok
-
Reporter name: Ondrej Pokorny
Original Reporter info from Mantis: kluug.net @onpok
- Reporter name: Ondrej Pokorny
Description:
project1.lpr(30,12) Error: Incompatible types: got "&LtPos;class method type of procedure of object;Register>" expected "TTest.&LtPos;procedure variable type of procedure;Register>"
Steps to reproduce:
See attached project:
type
TTest = class
public type
TProcedure = procedure;
private
class procedure MyProc; static;
public
constructor Create;
end;
{ TTest }
constructor TTest.Create;
var
aProc: TProcedure;
begin
aProc := @MyProc;
end;
class procedure TTest.MyProc;
begin
end;
Additional information:
Delphi mode works, usage with explicit class name "aProc := @TTest.MyProc" works as well.
Related to #27414 (closed).
Mantis conversion info:
- Mantis ID: 30936
- Version: 3.1.1
- Fixed in version: 3.1.1
- Fixed in revision: 34909 (#67570a62)
- Monitored by: » @michaliskambi (Michalis Kamburelis)