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

          Issue ID: 15847
           Summary: It is not an error to call opAssign on an
                    uninitialized object
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nob...@puremagic.com
          Reporter: monkeywork...@hotmail.com

struct Test
{
    int n;

    int opAssign(int val)
    {
        assert(n == int.init, "n is in an uninitialized state");
        return n = val;
    }
}

void main()
{
    Test t = void;
    //opAssign should not be called here as t is uninitialized
    t = 0; //BOOM
}

--

Reply via email to