changeset 1472:22767ec83a24

[Issue 932] static foreach in second template instantiation uses wrong tupleof Frits van Bommel <fvbommel@wxs.nl> 2007-02-06 http://d.puremagic.com/issues/show_bug.cgi?id=932
author thomask
date Thu, 05 Apr 2007 16:36:53 +0000
parents 44d9b47ed060
children 85bd7d2ddb7d
files run/f/foreach_38_A.d run/f/foreach_38_B.d run/f/foreach_38_C.d
diffstat 3 files changed, 88 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /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 <fvbommel@wxs.nl>
+// @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;
+}
--- /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 <fvbommel@wxs.nl>
+// @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;
+}
--- /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 <fvbommel@wxs.nl>
+// @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;
+}