Derived type

novice3 sorryno at em.ail
Wed Mar 31 04:49:50 UTC 2021


On Tuesday, 30 March 2021 at 21:53:34 UTC, Basile B. wrote:
> struct Typedef(TBase)
> {
>    TBase payload;
>    alias payload this;
> }
>
> alias Xobj = Typedef!(void*);

This is how std.typecons.Typedef made, IMHO.

The problem is this code generate struct with name 
"Typedef!(void*)",
then compiler show this name (not "Xobj") in messages:

https://run.dlang.io/is/eEI2yC

   void* bad;
   foo(bad);

Error: function foo(Typedef!(void*) obj) is not callable using 
argument types (void*)
        cannot pass argument bad of type void* to parameter 
Typedef!(void*) obj



More information about the Digitalmars-d-learn mailing list