Wrong behavior of generic "record parameter"
Original Reporter info from Mantis: hnb
-
Reporter name: Maciej Izak
Original Reporter info from Mantis: hnb
- Reporter name: Maciej Izak
Description:
Check out attached code:
program project4;
{$mode delphi}
type
TA<T: record> = record
end;
TUnamanagedRec = record
x: integer;
end;
TManagedRec = record
s: string;
end;
var
a: TA<TUnamanagedRec>; // should pass and it is ok
b: TA<TManagedRec>; // should pass and it is ok
d: TA<Single>; // should pass but it's not ok in FPC! Error: Record type expected
e: TA<Integer>; // should pass but it's not ok in FPC! Error: Record type expected
f: TA<Pointer>; // shouldn't pass and it's half ok. Expected message is - E2512 Type parameter 'T' must be a non-nullable value type!
g: TA<TObject>; // shouldn't pass and it's half ok. Expected message is - E2512 Type parameter 'T' must be a non-nullable value type!
h: TA<string>; // shouldn't pass and it's half ok. Expected message is - E2512 Type parameter 'T' must be a non-nullable value type!
// and so on...
begin
end.
Mantis conversion info:
- Mantis ID: 24073
- Version: 2.7.1
- Fixed in revision: 35739 (#e4565378)