Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
Share This
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
QualityCentral
Delphi Prism
Compatibility
Compiler
Database
Debugger
Demos
Documentation
IDE
Install
International Enabling
Other
Suggestion
You are not logged in.
Help
Print
Public Report
Report From:
Delphi Prism/Compiler
[ Add a report in this area ]
Report #:
88923
Status:
Open
Set equality operator does not work
Project:
Embarcadero Prism
Build #:
4.0.25.791
Version:
1.1
Submitted By:
Robert Ogren
Report Type:
Basic functionality failure
Date Reported:
10/13/2010 5:46:13 AM
Severity:
Critical / Show Stopper
Last Updated:
3/20/2012 2:24:39 AM
Platform:
All platforms
Internal Tracking #:
280833
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
The set equality and inequality operators do not seem to work in Delphi Prism XE. When I run simple code like this, the sets are not considered equal.
type MyAttribute = (
AttributeA,
AttributeB
);
MyAttributes = set of MyAttribute;
...
var a: MyAttributes := [MyAttribute.AttributeA];
if a = [MyAttribute.AttributeA] then
Console.WriteLine('Equality test succeeds')
else
Console.WriteLine('Equality test fails');
As far as I can see, this is a bug in <PublicImplementationDetails>+Set<T>.op_Equality
According to Reflector the comparison of the array elements looks like this:
if (((num >= a.fValue.Length) ? 0 : a.fValue) != ((num >= b.fValue.Length) ? 0 : b.fValue))
instead of this:
if (((num >= a.fValue.Length) ? 0 : a.fValue[num]) != ((num >= b.fValue.Length) ? 0 : b.fValue[num]))
I.e. it compares the array references instead of the actual elements.
Steps to Reproduce:
Compile and run the attached sample program, and watch the output. I expect it to say 'Equality test succeeds' but it does not.
Workarounds
None
Attachment
88923.zip
Comments
None
View Your Reports
Search
Server Response from: ETNACODE01
Developer Tools
Blackfish SQL
C++Builder
Delphi
FireMonkey
Prism
InterBase
JBuilder
J Optimizer
HTML5 Builder
3rdRail & TurboRuby
Database Tools
Change Manager
DBArtisan
DB Optimizer
ER/Studio
Performance Center
Rapid SQL
Technical Articles
Tutorials
White Papers
Press Releases
Newsletters
Add Content (GetPublished)
Audio
Audio & Video
Video
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Tags
Technology Partners
Downloads
Free Trials
Registered User Downloads
Beta Programs
Add Content (GetPublished)
Articles
Blogs
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Member Services
About
Connect with Us