View Issue Details

IDProjectCategoryView StatusLast Update
0038115FPCCompilerpublic2020-11-22 13:47
ReporterOkobaPatino Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version3.3.1 
Summary0038115: Set var to a procedure with a different param type
DescriptionFPC 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.
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Activities

Sven Barth

2020-11-22 13:47

manager   ~0127102

For the sake of completeness: Delphi fails to compile this (as long as the @'s are removed).

Issue History

Date Modified Username Field Change
2020-11-22 13:42 OkobaPatino New Issue
2020-11-22 13:47 Sven Barth Note Added: 0127102