[Mono-bugs] [Bug 50123][Wis] New - return void

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 25 Oct 2003 16:59:23 -0400 (EDT)


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 malekith@pld-linux.org.

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

--- shadow/50123	2003-10-25 16:59:23.000000000 -0400
+++ shadow/50123.tmp.3008	2003-10-25 16:59:23.000000000 -0400
@@ -0,0 +1,52 @@
+Bug#: 50123
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: malekith@pld-linux.org               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: return void
+
+Description of Problem:
+mcs doesn't complain when void value is used as value returned from
+function of type object.
+
+Steps to reproduce the problem:
+1. Compile and run the following program:
+
+class M {
+  static object foo() { return System.Console.WriteLine ("hello world!"); }
+  public static void Main () { foo(); }
+}
+
+
+Actual Results:
+
+** ERROR **: Invalid IL code at IL000a in .M:foo (): IL_000a: box      
+0x01000003
+
+
+aborting...
+zsh: 3258 abort      mono --debug test.exe
+
+
+Expected Results:
+
+Compilation error? Not sure.
+
+How often does this happen? 
+
+Always.
+
+Additional Information:
+
+I'm not quite sure if C# compiler should allow this.