www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13563] New: ICE with opIndexAssign op-overloading and

https://issues.dlang.org/show_bug.cgi?id=13563

          Issue ID: 13563
           Summary: ICE with opIndexAssign op-overloading and
                    ModuleScopeOperator
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ice
          Severity: major
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: k.hara.pg gmail.com

Separating issue from https://issues.dlang.org/show_bug.cgi?id=13356#c1

void writeConfig()
{
    JSONValue v;
    v["name"] = .z();
}

struct JSONValue
{
    import std.variant;
    alias Payload = Algebraic!(typeof(null));

    Payload payload;

    alias payload this;
}


Simplified test case:

struct Payload
{
    void opIndex(K)(K i) {}
    void opIndexAssign(T, N)(T value, N i) {}
}

struct Value
{
    Payload payload;
    alias payload this;
}

void main()
{
    Value v;
    v["name"] = .z();
}

--
Oct 01 2014