Bug 19200 – Variant operators don't overload correctly

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2018-08-28T12:44:37Z
Last change time
2018-09-02T07:07:29Z
Assigned to
No Owner
Creator
Simen Kjaeraas

Comments

Comment #0 by simen.kjaras — 2018-08-28T12:44:37Z
There are issues when using Variant with types that have their own overloaded operators: struct S { static int opBinaryRight(string op : "|", T)(T rhs) { return 3; } } unittest { import std.variant; S s; Variant v; auto b = v | s; } std\variant.d(1004): Error: no property min for type S In addition, Variant's operator overloads are of the old kind (opAdd, opMul, and so on). These should be updated anyway.
Comment #1 by github-bugzilla — 2018-09-02T07:07:28Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/71fc01cc63ee28648bdcd19faf8255c4dfeaf290 Fix issue 19200 https://github.com/dlang/phobos/commit/4873119553666819b4810a1318998eaad7476b08 Merge pull request #6684 from Biotronic/issue-19200 Fix issue 19200 - Variant operators don't overload correctly merged-on-behalf-of: Petar Kirov <[email protected]>