View Issue Details

IDProjectCategoryView StatusLast Update
0037939FPCCompilerpublic2020-10-20 22:56
ReporterDanny Milosavljevic Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status confirmedResolutionopen 
Product Version3.2.0 
Summary0037939: Generic type checking messes up and does not fail
DescriptionWith the program below, I unexpectedly do not get a compilation error.

Worse, at runtime, the weirdest values are printed.
Steps To Reproduce{$MODE DELPHI}
{$modeswitch advancedrecords}
type
  TMatrix<T, R, C> = record
    fCoordinates: array[R, C] of Double;
  end;
function mul<T, R, X, C>(A: TMatrix<T, R, X>; B: TMatrix<T, X, C>): TMatrix<T, R, C>;
begin
  Writeln('yep');
  Writeln(High(R)); // 3
  Writeln(High(X)); // 4
  Writeln(High(C)); // 3
end;
type
  R1 = 1..3;
  R2 = 1..4;
var
  A: TMatrix<Double, R1, R2>;
  B: TMatrix<Double, R1, R1>;
begin
  mul<Double, R1, R2, R1>(A,B); // should fail
  //mul(A,B); // does not work
end.
Tagsgenerics
Fixed in Revision
FPCOldBugId
FPCTarget-
Attached Files

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2020-10-17 03:48 Danny Milosavljevic New Issue
2020-10-20 22:56 Sven Barth Tag Attached: generics
2020-10-20 22:56 Sven Barth Status new => confirmed
2020-10-20 22:56 Sven Barth FPCTarget => -