On Sunday, 23 May 2021 at 14:13:36 UTC, Alain De Vos wrote:
This one compiles without any problem.
You annotated main `@trusted`, which means you want the compiler to assume it to be `@safe` without checking it. Mark it `@safe` and it reports:
Error: address of variable `a` assigned to `q` with longer lifetime