www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22076] New: hashOf(S) can segfault if S.toHash is forwarded

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

          Issue ID: 22076
           Summary: hashOf(S) can segfault if S.toHash is forwarded via
                    'alias this' to a receiver which may be null
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: n8sh.secondary hotmail.com

Demonstration:

---
void main()
{
    struct S
    {
        Object a;
        alias a this;
    }

    cast(void) .object.hashOf(S.init); // Segfaults.
}
---

--
Jun 22 2021