On Wednesday, 25 August 2021 at 12:11:01 UTC, Johann Lermer wrote:
```d
14 void main ()
15 {
16     auto ac = new Alias_Class;
17     Test_Struct ts = ac;  // compiles
18     ac = ts;              // compiles as well - why?
19
20     auto tc = new Test_Class;
21     ts = tc.ac;           // compiles
22 tc.ac = ts; // again this compiles, but seg faults
23 }
```

line 17: ac.ts is copied into main's ts
line 18: main's ts is copied back into ac.ts

You can confirm this by changing t, doing the copy, and then checking t.

line 21: segfaults because tc.ac is null, and you're trying to copy tc.ac.ts into main's ts

Reply via email to