www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23328] New: Segfault wrt. implicit function => delegate

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

          Issue ID: 23328
           Summary: Segfault wrt. implicit function => delegate conversion
                    in static initializers
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: kinke gmx.net

This segfaults at runtime with DMD v2.100.1:
```
struct S {
    string[] delegate() dg;
    string[] bla;
}

immutable S s = {
    dg: () => ["hello"], // works with explicit `delegate() => …`
    bla: ["blub"],
};

void main()  safe {
    import std.stdio;
    writeln(s.bla); // segfault
}
```

Works fine with LDC.

--
Sep 05 2022