[Mono-bugs] [Bug 79589][Nor] New - Cannot use constructor parameter when creating a new delegate parameter for overloaded constructor (!)

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Oct 5 17:39:16 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 vishal at digitalsilver.org.

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

--- shadow/79589	2006-10-05 17:39:16.000000000 -0400
+++ shadow/79589.tmp.16398	2006-10-05 17:39:16.000000000 -0400
@@ -0,0 +1,49 @@
+Bug#: 79589
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: OS X 10.4.8
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: vishal at digitalsilver.org               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Cannot use constructor parameter when creating a new delegate parameter for overloaded constructor (!)
+
+Steps to reproduce the problem:
+Try to compile:
+
+public class ClassOne
+{
+  public delegate string ReturnStringDelegate();
+
+  public ClassOne(ReturnStringDelegate d)
+  {
+    // do stuff here...
+  }
+
+  public ClassOne(string s)
+    : this(new ReturnStringDelegate(delegate() { return s; }))
+  {
+  }
+}
+
+Actual Results:
+Compiler fails with the error:
+
+  test.cs(11,57): error CS0103: The name `s' does not exist in the context
+of `ClassOne'
+
+Expected Results:
+Successful compilation with the behaviour being that the second constructor
+calls the first constructor with a new ReturnStringDelegate which returns s
+as the parameter.
+
+Additional Information:
+Works with Visual Studio 2005


More information about the mono-bugs mailing list