Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
Share This
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
QualityCentral
Delphi-BCB
Compiler
Delphi
Language
Default Parameters
Dynamic Arrays
Overloading
Variants
You are not logged in.
Help
Print
Public Report
Report From:
Delphi-BCB/Compiler/Delphi/Language/Variants
[ Add a report in this area ]
Report #:
100806
Status:
Open
Equality comparison between Variants wrong results
Project:
Delphi
Build #:
16.0.4316.44803
Version:
16.0
Submitted By:
Tommaso Ercole
Report Type:
Minor failure / Design problem
Date Reported:
11/7/2011 1:43:27 AM
Severity:
Serious / Highly visible problem
Last Updated:
3/20/2012 2:24:39 AM
Platform:
All platforms
Internal Tracking #:
288669
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:
10
Description
Comparison between different types wrapped inside Variants gives exceptions instead of False.
Steps to Reproduce:
Compile the attached project, should return two times PASSED, is returing two times FAILED.
-----------------
program VariantEquality;
{$APPTYPE CONSOLE}
{$R *.res}
uses
Generics.Defaults,
System.SysUtils;
var
A,
B: Variant;
begin
Write('VariantEquality, 1: ');
try
A:= '';
B:= StrToDateTime('22/12/2012');
if A = B then
Writeln('FAILED')
else
Writeln('PASSED');
except
Writeln('FAILED');
end;
Write('VariantEquality, 2: ');
try
A:= '';
B:= StrToDateTime('22/12/2012');
if TEqualityComparer<Variant>.Default.Equals( A, B ) then
Writeln('FAILED')
else
Writeln('PASSED');
except
Writeln('FAILED');
end;
end.
-----------------
Workarounds
try except around every single comparison
Attachment
100806.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