www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13424] New: Initialization of delegate to do-nothing default


          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 puremagic.com
          Reporter: hsteoh 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.

Sep 04 2014