crash when using &this in struct constructor

Eric geachte.eric at gmail.com
Mon Jul 16 22:08:34 UTC 2018


This makes the compiler crash. Is it illegal code?

struct List {
   private List* head;
   private List* tail;

   this(int x) {
     head = null;
     tail = &this; // <-- crasher
   }
}

List2 ls = 2;



More information about the Digitalmars-d-learn mailing list