Discussion Thread: DIP 1035-- at system Variables--Final Review

Dennis dkorpel at gmail.com
Fri Mar 4 14:00:31 UTC 2022


On Friday, 4 March 2022 at 13:09:42 UTC, Paul Backus wrote:
> As a result, the compiler will not allow you to void-initialize 
> a `void[1]` in `@safe` code:
>
> ```d
> void main() @safe {
>     void[1] a = void; // error
> }
> ```

That's new to me, and the error makes no sense considering you 
can (implicitly) convert any array to a `void[]` even in `@safe` 
code, so you can still do this:

```D
void main() @safe {
     ubyte[1] x = void;
     void[1] y = x;
}
```

> So, the workaround suggested by Dukc would indeed work.

It's an interesting alternative if we can nail it down.


More information about the Digitalmars-d mailing list