Bugzilla – Bug 313232
MCS produces bad code for foreach keyword
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by m.canini@libero.it 2003-11-27 13:21:23 MST ---- Description of Problem: The attached code compiled with mcs produces different effects than MS .Net and DotGNU Portable.Net I was unable to reproduce the effects i get in my app: a invalid cast exception. However the test case is able to show you that the code compiled with mcs calls a different overloaded version of Current method of my enumerator. Steps to reproduce the problem: 1. Compile the code with mcs 2. Compile the code with csc Actual Results: object IEnumerator.Current() Foo name: Second object IEnumerator.Current() Foo name: First Expected Results: Foo Current() Foo name: Second Foo Current() Foo name: First How often does this happen? Always Additional Information: ---- Additional Comments From m.canini@libero.it 2003-11-27 13:21:55 MST ---- Created an attachment (id=165207) code ---- Additional Comments From bmaurer@users.sf.net 2003-11-27 15:41:52 MST ---- The requirements here are pretty clearly defined in 15.8.4: The foreach statement. We are obviously not following these rules. I want to see if i can do this patch (as a challenge) so i am assigning it to myself. ---- Additional Comments From miguel@ximian.com 2003-11-27 17:43:49 MST ---- Fixed on CVS. Imported an attachment (id=165207) Unknown operating system unknown. Setting to default OS "Other".