www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - BUG: bad mixin behavior

reply Sean Kelly <sean f4.ca> writes:
Note that if I uncomment the printf line in main then the output is:

0
0

as it should be.


C:\code\d\bugs>type 147_1.d
import std.c.stdio;

template mix()
{
     int i;
     void print() { printf( "%i\n", i ); }
}

void main()
{
     mixin mix!();

     print();
     //printf( "%i\n", i );
}
C:\code\d\bugs>dmd 147_1.d
C:\bin\dmd\bin\..\..\dm\bin\link.exe 147_1,,,user32+kernel32/noi;

C:\code\d\bugs>147_1
4202539

C:\code\d\bugs>
Feb 24 2006
parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sean Kelly schrieb am 2006-02-24:
 Note that if I uncomment the printf line in main then the output is:

 0
 0

 as it should be.


 C:\code\d\bugs>type 147_1.d
 import std.c.stdio;

 template mix()
 {
      int i;
      void print() { printf( "%i\n", i ); }
 }

 void main()
 {
      mixin mix!();

      print();
      //printf( "%i\n", i );
 }
 C:\code\d\bugs>dmd 147_1.d
 C:\bin\dmd\bin\..\..\dm\bin\link.exe 147_1,,,user32+kernel32/noi;

 C:\code\d\bugs>147_1
 4202539

Added to DStress as http://dstress.kuehne.cn/run/m/mixin_17_A.d http://dstress.kuehne.cn/run/m/mixin_17_B.d http://dstress.kuehne.cn/run/m/mixin_17_C.d http://dstress.kuehne.cn/run/m/mixin_17_D.d http://dstress.kuehne.cn/run/m/mixin_17_E.d http://dstress.kuehne.cn/run/m/mixin_17_F.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFEBeFj3w+/yD4P9tIRAg30AKCnoowJ1BZKhA6tuh86ngp/Ba4OoACfZPdw Fr7NkaQkN7BX9pdaLAQ3zxM= =Vt8p -----END PGP SIGNATURE-----
Mar 01 2006