Generics explicit cast and boolean expression
Original Reporter info from Mantis: hnb
-
Reporter name: Maciej Izak
Original Reporter info from Mantis: hnb
- Reporter name: Maciej Izak
Description:
I can't compile generic code with this kind of expression (Foo method) code:
type
TB<T> = class abstract
end;
TC<T> = class(TB<T>)
FValue: Integer;
end;
TA<T> = class
function Foo: Boolean;
var
FB: TB<T>;
end;
{ TA&LtPos;T> }
function TA<T>.Foo: Boolean;
begin
Result := (TC<T>(FB).FValue <> 0) // Pass
and (0 < TC<T>(FB).FValue) // Error: identifier idents no member "FValue" -
// only if explicit cast is on right side of expression... For TC<T>(FB).FValue > 0 is ok...
end;
Mantis conversion info:
- Mantis ID: 24098
- Version: 2.7.1