www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22516] New: Segfault for function literal in struct


          Issue ID: 22516
           Summary: Segfault for function literal in struct initializer
                    with previous errors
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: moonlightsentinel disroot.org

The following code segfaults since 2.072:

struct Data
    void function() eval;


struct Builtins
    X x; // Unknown type X

    Data myData = { (){} };

The problem here is that the error in `x` causes semantic3 for the function
literal to be skipped because of errors in the parent. Later code tries to
access the missing return type of the function literal.

Nov 17 2021