[Mono-bugs] [Bug 77204][Wis] New - mcs permits calling instance
methods on items with type void
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Tue Jan 10 19:58:59 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 mathpup at mylinuxisp.com.
http://bugzilla.ximian.com/show_bug.cgi?id=77204
--- shadow/77204 2006-01-10 19:58:59.000000000 -0500
+++ shadow/77204.tmp.10273 2006-01-10 19:58:59.000000000 -0500
@@ -0,0 +1,79 @@
+Bug#: 77204
+Product: Mono: Compilers
+Version: 1.1
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: C#
+AssignedTo: rharinath at novell.com
+ReportedBy: mathpup at mylinuxisp.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: mcs permits calling instance methods on items with type void
+
+Description of Problem:
+
+The code below attempts to call a method using an instance of type void,
+which is an error. There seem to be two issues here. One is that mcs
+permits that code below at all. (csc rejects it with CS0023: Operator '.'
+cannot be applied to operand of type 'void'.) The second problem is that
+when the code produced by mcs is run, the runtime produces an error
+regarding invalid IL.
+
+
+using System;
+
+public class Testing
+{
+ public static void DoNothing() {}
+
+ public static void Main()
+ {
+ Console.WriteLine(DoNothing().ToString());
+ }
+}
+
+
+Steps to reproduce the problem:
+1. mcs testvoid.cs
+2. mono testvoid.exe
+
+
+Actual Results:
+
+Step 1 above succeeds (should fail).
+
+Step 2 yields
+** ERROR **: Invalid IL code at IL0005 in Testing:Main (): IL_0005: box
+0x01000002
+
+
+
+Expected Results:
+
+
+How often does this happen?
+
+Always
+
+Additional Information:
+
+ildasm dump for Main():
+
+ .method public hidebysig static void Main() cil managed
+ {
+ .entrypoint
+ // Code size 21 (0x15)
+ .maxstack 8
+ IL_0000: call void Testing::DoNothing()
+ IL_0005: box [mscorlib]System.Void
+ IL_000a: call instance string
+[mscorlib]System.ValueType::ToString()
+ IL_000f: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0014: ret
+ } // end of method Testing::Main
More information about the mono-bugs
mailing list