On Tuesday, 30 March 2021 at 14:45:12 UTC, WebFreak001 wrote:
Xobj can then be used interchangeably with void*, so all void*
arguments accept Xobj and all Xobj arguments accept void*.
yes, i understand alias, and i dont want such behaviour
If you want a type-safe alias that makes all void* arguments
accept Xobj but not Xobj arguments to accept void*
yes, this is that i search
you can use `Typedef` like you linked.
Problem with Typedef template - code
alias Xobj = Typedef!(void*)
not generate type named "Xobj",
but type named "Typedef!(void*, null, null)".
This makes compiler error messages unusable.
enum Xobj : void*;
```
This allows explicit conversion in both ways using cast, but
only allows implicit conversion from Xobj to void*, not from
void* to Xobj:
Strange syntax.
Behavour exactly what i want, but this code not works for me :(
enum Xobj : void*;
Xobj var; //DMD Error: enum test7.Xobj forward reference of
Xobj.init