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

ag0ae...@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |ag0ae...@gmail.com
         Resolution|---                         |INVALID

--- Comment #2 from ag0ae...@gmail.com ---
This is expected.

`clsPtr.a` does two dereferences:
1) `clsPtr` is dereferenced and yields a `clsTest` object. Class objects are
references (pointers) themselves. Since `buf` is all zeroes, you get a null
Object.
2) To access the `a` field, that null reference is then dereferenced. Boom,
segfault.

In code:
    clsTest tmp = *clsPtr;
    /* tmp is null */
    tmp.a = 123; /* dereferencing null */

Closing as invalid.

--

Reply via email to