View Issue Details

IDProjectCategoryView StatusLast Update
0035687FPCRTLpublic2019-08-02 16:49
Reporterrd0xAssigned ToSven Barth 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version3.3.1Product Build 
Target VersionFixed in Version3.3.1 
Summary0035687: Add TValue.FromOrdinal to RTTI
DescriptionFPC misses TValue.FromOrdinal functionality
Steps To Reproducetry to run code from http://softwareonastring.com/147/how-to-store-enums-without-losing-your-coding-freedom in 'Generics with extended RTTI' section and it will fail due to missing function
Additional Informationclass function TValue.FromOrdinal(ATypeInfo: PTypeInfo; AValue: Int64): TValue;
begin
  if (FData.FTypeInfo=nil) or not (FData.FTypeInfo^.Kind in [tkInteger, tkChar, tkWChar, tkEnumeration, tkInt64]) then
    raise Exception.CreateFmt(SErrUnableToGetValueForType,[ATypeInfo^.Name]);

  TValue.Make(@AValue, ATypeInfo, Result);
end;
TagsRTTI
Fixed in Revision42221
FPCOldBugId
FPCTarget-
Attached Files

Activities

Sven Barth

2019-06-13 23:11

manager   ~0116716

I used the same kind of exception that Delphi uses.

Please test and close if okay.

Issue History

Date Modified Username Field Change
2019-06-07 23:40 rd0x New Issue
2019-06-13 23:10 Sven Barth Tag Attached: RTTI
2019-06-13 23:11 Sven Barth Assigned To => Sven Barth
2019-06-13 23:11 Sven Barth Status new => resolved
2019-06-13 23:11 Sven Barth Resolution open => fixed
2019-06-13 23:11 Sven Barth Fixed in Version => 3.3.1
2019-06-13 23:11 Sven Barth Fixed in Revision => 42221
2019-06-13 23:11 Sven Barth FPCTarget => -
2019-06-13 23:11 Sven Barth Note Added: 0116716
2019-08-02 16:49 rd0x Status resolved => closed