www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20779] New: Segfault when self-containing struct is accessed

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

          Issue ID: 20779
           Summary: Segfault when self-containing struct is accessed from
                    inside in a __traits(compiles) context
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: default_357-line yahoo.de

Consider this code:

struct X {
    X x;
    enum e = __traits(compiles, X.init);
}

DMD tries to warn us that X cannot contain itself as a field; however, the
error is eaten by the __traits(compiles). Then it segfaults.

--
Apr 28 2020