Set var to a procedure with a different param type
Original Reporter info from Mantis: okobapatino @OkobaPatino
-
Reporter name: OkobaPatino
Original Reporter info from Mantis: okobapatino @OkobaPatino
- Reporter name: OkobaPatino
Description:
FPC allows setting T to TestInt2, although the params are different. It should raise an error like setting it to TestString as TInt1 and TInt2 are independent.
program Project1;
type
TInt1 = type integer;
PInt1 = ^TInt1;
TInt2 = type integer;
PInt2 = ^TInt2;
TTestInt1 = procedure(A: PInt1);
TTestInt2 = procedure(A: PInt2);
procedure TestInt1(A: PInt1);
begin
WriteLn('1');
end;
procedure TestInt2(A: PInt2);
begin
WriteLn('2');
end;
procedure TestString(A: PString);
begin
end;
var
T: TTestInt1;
begin
T := @TestInt2; //Allows this
T := @TestString; //Does not allow this
end.
Mantis conversion info:
- Mantis ID: 38115
- Version: 3.3.1
- Monitored by: » @OkobaPatino (OkobaPatino)