On 01/19/2017 12:03 AM, Chris Katko wrote:

> template sizer2D() // no params here for simplicity
>     {
>     const char [] sizer2D = "64,64";
>     }

>     array_t!(mixin(sizer2D!())) case2; // FAILS (error below)

> Error: template instance array_t!64 does not match template declaration
> array_t(int width, int height)

The comma operator strikes back but this time it's caught. :) The clue was exposed because my compilation has the following dmd flag:

  -de  show use of deprecated features as errors (halt compilation)

According to spec, "The text contents of the string must be compilable as a valid StatementList, and is compiled as such.":

  https://dlang.org/spec/statement.html#mixin-statement

So, "64,64" is mixed in as two expressions around a comma operator and it gets the value 64.

Ali

Reply via email to