[Mono-bugs] [Bug 77402][Nor] New - anonymous method miscompilation with no inferred delegate type

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Jan 30 07:00:15 EST 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 lupus at ximian.com.

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

--- shadow/77402	2006-01-30 07:00:15.000000000 -0500
+++ shadow/77402.tmp.26965	2006-01-30 07:00:15.000000000 -0500
@@ -0,0 +1,35 @@
+Bug#: 77402
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: lupus at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: anonymous method miscompilation with no inferred delegate type
+
+When mcs can't infer the delegate type to use for an anonymous method
+expression it produces incorrect IL code.
+See this test case:
+using System;
+class Test {
+	public static void Main(string[] argv) {
+		Console.WriteLine("Type of anonymous block: {0}",
+			(delegate() {}).GetType());
+	}
+}
+It should give a meaningful error instead (from reading the standard this
+is not valid C# code, but if it is valid it should compile to correct code:-).
+Also, when assigning an anon method expression to object or to Delegate etc,
+the error could be improved: it currently says:
+Cannot implicitly convert type anonymous method to `System.Delegate'
+Maybe it should tell that the assignment or the context should make clear
+what the target delegate type is.


More information about the mono-bugs mailing list