[Mono-bugs] [Bug 649448] New: REGRESSION: labels inside of delegates defined as a method argument cannot be resolved

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Oct 26 19:43:46 EDT 2010


https://bugzilla.novell.com/show_bug.cgi?id=649448

https://bugzilla.novell.com/show_bug.cgi?id=649448#c0


           Summary: REGRESSION: labels inside of delegates defined as a
                    method argument cannot be resolved
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.8.x
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: michael.letterle at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Customer
           Blocker: ---


Consider the following:


namespace TestGotoLabels
{
  class GotoLabelsTest
  {
    public delegate void MyDelegate();
#if BROKE
    public void TestMethod()
    {
      TestMethod2( delegate()
    {
          goto outLabel;        
       outLabel:
       System.Environment.Exit(0);
    });
    }
#endif
#if WORKS
    public void TestMethod()
    {
      MyDelegate md = delegate()
    {
          goto outLabel;        
       outLabel:
       System.Environment.Exit(0);
    };
      TestMethod2(md);
    }
#endif

      public static void TestMethod2(MyDelegate md)
      {
    md.Invoke();
      }
    }
  } 

 mcs -t:library -d:BROKE gtest.cs
gtest.cs(11,16): error CS0159: The label `outLabel:' could not be found within
the scope of the goto statement
gtest.cs(12,12): warning CS0162: Unreachable code detected
Compilation failed: 1 error(s), 1 warnings


Defining the WORKS symbol causes compilation to succeed.

The BROKE code appears to work in 2.4.4

-- 
Configure bugmail: https://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