Re: Safe code doesnt seem to complain when it should

2022-01-06 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 6 January 2022 at 16:12:10 UTC, HuskyNator wrote: I can't figure out why this code works: ```d union A { int* b; float c; } int fun(A a) @safe { return *(()=>a.b)(); // return *a.b; //Complains about pointer type overlap } ``` I tried to find out how

Safe code doesnt seem to complain when it should

2022-01-06 Thread HuskyNator via Digitalmars-d-learn
I can't figure out why this code works: ```d union A { int* b; float c; } int fun(A a) @safe { return *(()=>a.b)(); // return *a.b; //Complains about pointer type overlap } ``` I tried to find out how `@safe` should be handled in this scenario, and found [lambda'