[Mono-bugs] [Bug 80249][Maj] Changed - [GMCS] incorrect compilation of foreach

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Dec 13 15:34:39 EST 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by marek.safar at seznam.cz.

http://bugzilla.ximian.com/show_bug.cgi?id=80249

--- shadow/80249	2006-12-13 12:32:53.000000000 -0500
+++ shadow/80249.tmp.23674	2006-12-13 15:34:39.000000000 -0500
@@ -64,6 +64,34 @@
 ------- Additional Comments From miguel at ximian.com  2006-12-13 12:32 -------
 Am going to CC Marek and Martin for good measure, as he has been
 looking at some of these bits recently.  Marek, do you know what is
 going on?
 
 
+
+------- Additional Comments From marek.safar at seznam.cz  2006-12-13 15:34 -------
+Here is little bit simplified version
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+class MyDict : IEnumerable<KeyValuePair<object,object>> {
+	IEnumerator<KeyValuePair<object, object>>
+IEnumerable<KeyValuePair<object,object>>.GetEnumerator() {
+		KeyValuePair<object, object> o = new KeyValuePair<object,
+object>("hello", "world");
+		yield return o;
+	}
+
+	public IEnumerator GetEnumerator() {
+		throw new NotImplementedException();
+	}
+}
+class T {
+	static void Main () {
+		MyDict dict = new MyDict ();
+		foreach (KeyValuePair<object, object> o in dict) {
+			Console.WriteLine ("{0} {1}", o.Key, o.Value);
+		}
+	}
+}


More information about the mono-bugs mailing list