www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Compiler crash: mixin with static if.

reply Don Clugston <dac nospam.com.au> writes:
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;
}
Nov 11 2005
parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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 -----BEGIN PGP SIGNATURE----- iD8DBQFDdcbe3w+/yD4P9tIRAkgJAJ4k/N8vEAfqaLVR3QL9+jCdRJgXGwCfW8Kn QFxxmY1EF2SMOBi6/uXA/S0= =j9bi -----END PGP SIGNATURE-----
Nov 12 2005