Generic type checking messes up and does not fail
Original Reporter info from Mantis: dannym
-
Reporter name: Danny Milosavljevic
Original Reporter info from Mantis: dannym
- Reporter name: Danny Milosavljevic
Description:
With 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.
Mantis conversion info:
- Mantis ID: 37939
- Build: x86_64
- Version: 3.2.0