[Mono-bugs] [Bug 80650][Wis] New - [GMCS] Anonymous methods loose parameter scope when declared in base()

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Jan 28 13:15:34 EST 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by grompf at sublimeintervention.com.

http://bugzilla.ximian.com/show_bug.cgi?id=80650

--- shadow/80650	2007-01-28 13:15:34.000000000 -0500
+++ shadow/80650.tmp.6924	2007-01-28 13:15:34.000000000 -0500
@@ -0,0 +1,46 @@
+Bug#: 80650
+Product: Mono: Compilers
+Version: 1.2
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: grompf at sublimeintervention.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [GMCS] Anonymous methods loose parameter scope when declared in base()
+
+The following code:
+
+using System;
+
+public class BaseClass {
+        public delegate void SomeDelegate ();
+        public BaseClass (SomeDelegate d) {
+                d();
+        }
+}
+
+public class TestClass : BaseClass {
+        public readonly int Result;
+        public TestClass (int result)
+                : base(delegate () {
+                        Console.WriteLine (result);
+                }) {
+        }
+        static void Main (string [] args) {
+                TestClass c = new TestClass (1);
+        }
+}
+
+compiles and runs on ms.net but results in:
+
+bug.cs(15,23): error CS0103: The name `result' does not exist in the context of `TestClass'
+
+on gmcs.


More information about the mono-bugs mailing list