Bug 536801 - gmcs fails to compile some switch expressions in anonymous methods
Summary: gmcs fails to compile some switch expressions in anonymous methods
Status: RESOLVED DUPLICATE of bug 336258
Alias: None
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: SVN
Hardware: All All
: P5 - None : Normal
Target Milestone: ---
Assignee: Mono Bugs
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-04 10:19 UTC by Leszek Ciesielski
Modified: 2009-09-24 17:28 UTC (History)
0 users

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


Attachments
test case (736 bytes, text/plain)
2009-09-04 10:19 UTC, Leszek Ciesielski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Leszek Ciesielski 2009-09-04 10:19:36 UTC
Created attachment 316791 [details]
test case

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 4.0.20506) AutoPager/0.5.2.2 (http://www.teesoft.info/)

gmcs fails to compile an anonymous method which:
1. Returns a value
2. Contains a 'switch' statement, in which each case 'returns'
3. 'default' case contains a 'return' statement or 'throw'

A workaround is to change the body of the 'default' branch to 'break;' and throw/return the default value after the 'switch'.

Error message: "error CS1643: Not all code paths return a value in anonymous method of type 'X'".

Reproducible: Always

Steps to Reproduce:
A test case is attached. The first switch compiles fine, the second and third do not.
Actual Results:  
Error message: "error CS1643: Not all code paths return a value in anonymous method of type 'X'".

Expected Results:  
The code should compile fine (it does on MS.Net).
Comment 1 Marek Safar 2009-09-24 17:28:13 UTC
duplicate

*** This bug has been marked as a duplicate of bug 336258 ***