[Mono-bugs] [Bug 75850][Nor] New - [GMCS] gmcs incorrect chooses
non-generic GetEnumerator () method
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Fri Aug 19 11:45:12 EDT 2005
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 vargaz at gmail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=75850
--- shadow/75850 2005-08-19 11:45:12.000000000 -0400
+++ shadow/75850.tmp.12272 2005-08-19 11:45:12.000000000 -0400
@@ -0,0 +1,53 @@
+Bug#: 75850
+Product: Mono: Compilers
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: vargaz at gmail.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: [GMCS] gmcs incorrect chooses non-generic GetEnumerator () method
+
+Test case:
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+using System;
+using System.Threading;
+using System.Collections;
+using System.Collections.Generic;
+
+public class Dict : Dictionary <object, object>
+{
+}
+
+public class Foo
+{
+ public static void Main () {
+ IDictionary<object, object> dict = new Dict ();
+
+ dict.Add (new Object (), new Object ());
+ foreach (object kv in dict)
+ Console.WriteLine (kv.GetType ());
+ }
+}
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+When compiling this with gmcs, it prints:
+System.Collections.DictionaryEntry
+
+When compiling it with csc, it prints:
+System.Collections.Generic.KeyValuePair`2
+
+This is because gmcs generates a call to :
+
+ callvirt instance class[mscorlib]System.Collections.IEnumerator class
+[mscorlib]System.Collections.IEnumerable::GetEnumerator()
+
+while csc generates a call to the generic GetEnumerator () method.
More information about the mono-bugs
mailing list