November 11, 2005
It works if the first branch is taken. EG if you change the third line to
static if (n!=1)
or if you change the invocation to: mixin u!(1);
But the code below GPFs DMD 0.138 Windows.
------------------
template u(int n)
{
   static if (n==1) {
      int a = 1;
   } else
      int a = 4;
}

int main()
{
  mixin u!(2);
  return 0;
}
November 12, 2005
Don Clugston schrieb am 2005-11-11:
> It works if the first branch is taken. EG if you change the third line to
> static if (n!=1)
> or if you change the invocation to: mixin u!(1);
> But the code below GPFs DMD 0.138 Windows.
> ------------------
> template u(int n)
> {
>     static if (n==1) {
>        int a = 1;
>     } else
>        int a = 4;
> }
>
> int main()
> {
>    mixin u!(2);
>    return 0;
> }

Added to DStress as http://dstress.kuehne.cn/run/s/static_if_06_A.d http://dstress.kuehne.cn/run/s/static_if_06_B.d

Thomas