# HG changeset patch # User thomask # Date 1175791013 0 # Node ID 22767ec83a24ab5bbd076c58ed5271200ae2c64e # Parent 44d9b47ed0602113a12d4f66ebb224336f0d8cb7 [Issue 932] static foreach in second template instantiation uses wrong tupleof Frits van Bommel 2007-02-06 http://d.puremagic.com/issues/show_bug.cgi?id=932 diff -r 44d9b47ed060 -r 22767ec83a24 run/f/foreach_38_A.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/f/foreach_38_A.d Thu Apr 05 16:36:53 2007 +0000 @@ -0,0 +1,30 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Frits van Bommel +// @date@ 2007-02-06 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=932 +// @desc@ [Issue 932] static foreach in second template instantiation uses wrong tupleof + +module dstress.run.f.foreach_38_A; + +void Fields(C)(){ + foreach(i, a; typeof(C.tupleof)){ + static assert(is(typeof(a) == typeof(C.tupleof)[i])); + } +} + +struct MyStruct1 { + int afield; +} + +struct MyStruct2 { + real afield; +} + +int main(){ + Fields!(MyStruct1); + Fields!(MyStruct2); + return 0; +} diff -r 44d9b47ed060 -r 22767ec83a24 run/f/foreach_38_B.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/f/foreach_38_B.d Thu Apr 05 16:36:53 2007 +0000 @@ -0,0 +1,29 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Frits van Bommel +// @date@ 2007-02-06 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=932 +// @desc@ [Issue 932] static foreach in second template instantiation uses wrong tupleof + +module dstress.run.f.foreach_38_B; + +void Fields(C)(){ + foreach(i, a; typeof(C.tupleof)){ + static assert(is(typeof(a) == typeof(C.tupleof)[i])); + } +} + +struct MyStruct1 { + int afield; +} + +struct MyStruct2 { + real afield; +} + +int main(){ + Fields!(MyStruct1); + return 0; +} diff -r 44d9b47ed060 -r 22767ec83a24 run/f/foreach_38_C.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/f/foreach_38_C.d Thu Apr 05 16:36:53 2007 +0000 @@ -0,0 +1,29 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Frits van Bommel +// @date@ 2007-02-06 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=932 +// @desc@ [Issue 932] static foreach in second template instantiation uses wrong tupleof + +module dstress.run.f.foreach_38_C; + +void Fields(C)(){ + foreach(i, a; typeof(C.tupleof)){ + static assert(is(typeof(a) == typeof(C.tupleof)[i])); + } +} + +struct MyStruct1 { + int afield; +} + +struct MyStruct2 { + real afield; +} + +int main(){ + Fields!(MyStruct2); + return 0; +}