[Issue 13424] New: Initialization of delegate to do-nothing default causes segfault at runtime

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Sep 4 16:03:21 PDT 2014


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

          Issue ID: 13424
           Summary: Initialization of delegate to do-nothing default
                    causes segfault at runtime
           Product: D
           Version: D2
          Hardware: x86
                OS: Linux
            Status: NEW
          Severity: critical
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: hsteoh at quickfur.ath.cx

I have a struct of delegates that I'd like to default to do-nothing stubs:
------
struct S {
    void delegate(dchar ch) onChar = (dchar) {};
    ... /* other delegate variables similarly initialized */
}
------

It compiles, but crashes at runtime. Looking at the assembly code, it appears
to be attempting to call an invalid pointer.

--


More information about the Digitalmars-d-bugs mailing list