[Mono-bugs] [Bug 73485][Nor] New - Problem compiling recursive delegates
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 8 Mar 2005 15:42:51 -0500 (EST)
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 dsilva@ccs.neu.edu.
http://bugzilla.ximian.com/show_bug.cgi?id=73485
--- shadow/73485 2005-03-08 15:42:51.000000000 -0500
+++ shadow/73485.tmp.6765 2005-03-08 15:42:51.000000000 -0500
@@ -0,0 +1,67 @@
+Bug#: 73485
+Product: Mono: Compilers
+Version: 1.1
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: dsilva@ccs.neu.edu
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Problem compiling recursive delegates
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+Inconsistent C# compiler behavior (gmcs).
+
+Steps to reproduce the problem:
+
+This program compiles with no warnings:
+
+public class Test1 {
+ public static void Main(string[] args) {
+ check_t check = delegate (object[] instrs, int MC) {
+ if (MC < instrs.Length) {
+ object instr = instrs[MC];
+ System.Console.WriteLine("Hello world: {0}", instr);
+ check(instrs, MC + 1);
+ }
+ };
+ check(new object[]{"foo", "bar"}, 0);
+ }
+
+ delegate void check_t(object[] instrs, int MC);
+}
+
+This equivalent program does not compile:
+
+public class Test2 {
+ public static void Main(string[] args) {
+ // the following line is the only change
+ object[] instrs = new object[]{"one", "two"};
+ check_t check = delegate (object[] instrs, int MC) {
+ if (MC < instrs.Length) {
+ object instr = instrs[MC];
+ System.Console.WriteLine("Hello world: {0}", instr);
+ check(instrs, MC + 1);
+ }
+ };
+ check(new object[]{"foo", "bar"}, 0);
+ }
+
+ delegate void check_t(object[] instrs, int MC);
+}
+
+Actual Results:
+
+$ gmcs Test2.cs
+Test2.cs(9) error CS0103: The name `check' could not be found in `Test2'
+Compilation failed: 1 error(s), 0 warnings