[Mono-bugs] [Bug 536801] New: gmcs fails to compile some switch expressions in anonymous methods

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Sep 4 06:19:38 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=536801


           Summary: gmcs fails to compile some switch expressions in
                    anonymous methods
    Classification: Mono
           Product: Mono: Compilers
           Version: SVN
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: skolima at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Created an attachment (id=316791)
 --> (http://bugzilla.novell.com/attachment.cgi?id=316791)
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).

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list