This code completely breaks the compiler:

Ruby The Roobster rubytheroobster at yandex.com
Fri Aug 19 03:10:38 UTC 2022


This snippet compiles.  Even if `dsds` and `sadsad` are defined 
nowhere, this code compiles.

```d
import std.typecons : Tuple;

sadsad executeFunction(Mtypes...)(dstring func, Tuple!(Mtypes) 
args)
{
     static foreach(type; typel.keys)
     {
         mixin(typel[type] ~ " ret"d ~ type ~ ";");
     }

     dstring returnType = "Number"d;

     Switch: final switch(returnType)
     {
         static foreach(type; typel.keys)
         {
             case type:
                 mixin("alias ret = ret"d ~ type ~ ";");
                 break Switch;
         }
     }
     dsds ret;
     return ret;
}
```

The reason why this compiles is because of the varidic template 
parameter, `Mtypes`.

Either there is something I'm missing, or the compiler completely 
breaks when it sees varidic template arguments.


More information about the Digitalmars-d-learn mailing list