www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19200] New: Variant operators don't overload correctly


          Issue ID: 19200
           Summary: Variant operators don't overload correctly
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: simen.kjaras gmail.com

There are issues when using Variant with types that have their own overloaded

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.

Aug 28 2018