Bug 313232 (MONO51446) - MCS produces bad code for foreach keyword
Summary: MCS produces bad code for foreach keyword
Status: RESOLVED FIXED
Alias: MONO51446
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Major
Target Milestone: ---
Assignee: Ben Maurer
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-11-27 20:21 UTC by Marco Canini
Modified: 2007-09-15 21:24 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
code (1.78 KB, text/plain)
2003-11-27 20:21 UTC, Thomas Wiest
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 18:20: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".