Bug 12157 – Variant opEquals always returns false for classes.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-02-13T22:02:00Z
Last change time
2014-03-15T18:50:05Z
Keywords
pull
Assigned to
opantm2+dbugs
Creator
opantm2+dbugs

Comments

Comment #0 by opantm2+dbugs — 2014-02-13T22:02:00Z
Sample: import std.variant; class Foo { int a; } void main() { Foo f = new Foo(); Variant v = f; assert(v == f); } Because the check for if it's possible checks if typeof T.init == T.init, which is a compiler error for classes as it compares to null.
Comment #1 by opantm2+dbugs — 2014-02-23T21:49:53Z
Comment #2 by github-bugzilla — 2014-03-15T10:21:51Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/83b0cf52a5712fa1d1c2aaf984bbf31390f6b35f Fix issue 12157 - Variant opEquals always returns false for classes and interfaces. https://github.com/D-Programming-Language/phobos/commit/549657fe65082a01f697943105b9cb0aab86550a Merge pull request #1963 from Kapps/fix12157 Fix issue 12157 - Variant opEquals always returns false for classes.