Allow this() { } for structs

IGotD- nise at nise.com
Sat Nov 7 10:56:29 UTC 2020


On Saturday, 7 November 2020 at 01:39:30 UTC, Q. Schroll wrote:
>
> This is stupid; one shouldn't need to add useless parameters to 
> any function, except maybe for compatibility with an interface. 
> This isn't near that.
>

Speaking of stupid, what the compiler can do is lowering the 
this() to something else.

struct T
{
     this();
}

is lowered to

struct T
{
     this(StupidCompilerMadeUpType);
}

Then it just works, basically using your workaround inside the 
compiler. Horrible, but it would work.


More information about the Digitalmars-d mailing list