View Issue Details

IDProjectCategoryView StatusLast Update
0024098FPCCompilerpublic2015-01-06 14:10
ReporterMaciej Izak Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version2.7.1 
Summary0024098: Generics explicit cast and boolean expression
DescriptionI 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<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;
Tagsgenerics
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Relationships

related to 0027206 resolvedSven Barth [Patch] Christmas gift by FreeSparta : Generics.Collections 

Activities

Maciej Izak

2013-03-21 12:33

reporter  

project6.lpr (516 bytes)

Issue History

Date Modified Username Field Change
2013-03-21 12:33 Maciej Izak New Issue
2013-03-21 12:33 Maciej Izak File Added: project6.lpr
2013-03-21 12:35 Maciej Izak Tag Attached: generics
2015-01-06 14:10 Sven Barth Relationship added related to 0027206