Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/RTTI    [ Add a report in this area ]  
Report #:  128970   Status: Open
TRttiSetType returns invalid TypeSize
Project:  Delphi Build #:  XE6, XE7
Version:    21.0 Submitted By:   Peter Taraba
Report Type:  Basic functionality failure Date Reported:  11/19/2014 6:44:43 AM
Severity:    Serious / Highly visible problem Last Updated: 11/19/2014 7:13:12 PM
Platform:    All platforms Internal Tracking #:   56720
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: 1
Description
Property "TypeSize" of TRttiSetType returns incorrect values for large sets.

but both values have to be equal!!!
Steps to Reproduce:
example:
---------
type
  TByteSet = set of Byte;
var
  setType: TRttiSetType;
begin

  setType := (context.GetType(TypeInfo(TByteSet)) as TRttiSetType);

  Writeln(setType.TypeSize);
  Writeln(SizeOf(TByteSet));

end.
---------

writes to output:
1
32

Workarounds
None
Attachment
None
Comments

Tomohiro Takahashi at 11/19/2014 7:09:00 PM -
http://docwiki.embarcadero.com/Libraries/XE6/en/System.Rtti.TRttiType.TypeSize
says
---------
Use TypeSize to obtain the size of a variable of the reflected type. The same value can be obtained by using the SizeOf operator.
---------

Peter Taraba at 11/19/2014 11:44:23 PM -
Yeah exactly, but SizeOf(TByteSet) = 32 and (lType.TypeSize = 1) for TByteSet. TypeSize returns incorrect values for large sets. When set type takes 1, 2, 4 Bytes of memory return value is correct.

Server Response from: ETNACODE01