[Mono-bugs] [Bug 79153][Min] New - Anonymous delegates let shadow variables

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Aug 24 05:15:59 EDT 2006


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 pawel.sakowski at mindbreeze.com.

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

--- shadow/79153	2006-08-24 05:15:59.000000000 -0400
+++ shadow/79153.tmp.28659	2006-08-24 05:15:59.000000000 -0400
@@ -0,0 +1,45 @@
+Bug#: 79153
+Product: Mono: Compilers
+Version: 1.1
+OS: GNU/Linux [Other]
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: pawel.sakowski at mindbreeze.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Anonymous delegates let shadow variables
+
+Description of Problem:
+Gmcs (1.1.13.6) lets shadow a parent scope variable in a child scope, if
+the inner scope is an anonymous delegate. This leads to ambigous variable
+resolution. Microsoft compiler rejects such code.
+
+Steps to reproduce the problem:
+1. gmcs the following code:
+
+delegate void D();
+class A{
+    static void Main(){
+        int i;
+        D d = delegate {int i;};
+    }
+}
+
+Actual Results:
+success
+
+Expected Results:
+Report an error, like the Microsoft compiler does.
+"A local variable named 'i' cannot be declared in this scope because it
+would give a different meaning to 'i', which is already used in a 'parent
+or current' scope to denote something else"
+
+How often does this happen? 
+100%


More information about the mono-bugs mailing list