Bugzilla – Bug 536801
gmcs fails to compile some switch expressions in anonymous methods
Last modified: 2009-09-24 17:28:13 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).
duplicate *** This bug has been marked as a duplicate of bug 336258 ***