Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/RTTI    [ Add a report in this area ]  
Report #:  132215   Status: Open
TValue.IsOrdinal and TValue.TryAsOrdinal are inconsistent
Project:  Delphi Build #:  21.0.17707.5020
Version:    21.0 Submitted By:   CAS Developers
Report Type:  Basic functionality failure Date Reported:  6/25/2015 1:20:28 AM
Severity:    Commonly encountered problem Last Updated: 7/13/2015 2:56:49 AM
Platform:    All versions Internal Tracking #:   65036
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
TValue.TryAsOrdinal returns an ordinal value for any of the following types:

tkInteger, tkChar, tkWChar, tkEnumeration, tkSet, tkInt64.

TValue.IsOrdinal returns True for all the same types EXCEPT tkSet.

Despite there being fully functioning code to handle set properties in TryAsOrdinal, it fails because IsOrdinal doesn't check for the correct list of types (ever heard of a constant?).

This should be dead easy to fix; just add tkSet to TValue.IsOrdinal.
Steps to Reproduce:
1. Open System.Rtti from the Delphi\Source\rtl\common folder.
2. Compare the TypeInfo!.Kind values checked in TValue.IsOrdinal (around line 2418) and TValue.TryAsOrdinal (around line 2427).
3. Gasp in shock and horror.
Workarounds
None
Attachment
None
Comments

None

Server Response from: ETNACODE01