[Mono-bugs] [Bug 69926][Maj] New - struct X {} X x = new X (); using (x) ;
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Thu, 25 Nov 2004 17:12:27 -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 bmaurer@users.sf.net.
http://bugzilla.ximian.com/show_bug.cgi?id=69926
--- shadow/69926 2004-11-25 17:12:27.000000000 -0500
+++ shadow/69926.tmp.4317 2004-11-25 17:12:27.000000000 -0500
@@ -0,0 +1,105 @@
+Bug#: 69926
+Product: Mono: Compilers
+Version: 1.0
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Major
+Component: C#
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: bmaurer@users.sf.net
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: struct X {} X x = new X (); using (x) ;
+
+using System;
+
+struct X : IDisposable {
+ public void Dispose ()
+ {
+ }
+
+ static void Main ()
+ {
+ X x = new X ();
+ using (x)
+ ;
+ }
+}
+
+[benm@omega benm]$ mcs t.cs
+Compilation succeeded
+[benm@omega benm]$ mono t.exe
+
+** ERROR **: Invalid IL code at IL0015 in X:Main (): IL_0015: ldloc.1
+
+
+aborting...
+Aborted
+
+
+[benm@omega benm]$ monodis t.exe
+.assembly extern mscorlib
+{
+ .ver 1:0:5000:0
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+}
+.assembly 't'
+{
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module t.exe // GUID = {9F2B4A60-8B89-4FBC-8166-4F83C2BB0890}
+
+
+ .class private sequential ansi sealed beforefieldinit X
+ extends [mscorlib]System.ValueType
+ implements [mscorlib]System.IDisposable {
+ .field private unsigned int8 $PRIVATE$
+
+ // method line 1
+ .method public final virtual hidebysig newslot
+ instance default void Dispose () cil managed
+ {
+ // Method begins at RVA 0x20ec
+ // Code size 1 (0x1)
+ .maxstack 8
+ IL_0000: ret
+ } // end of method X::instance default void Dispose ()
+
+ // method line 2
+ .method private static hidebysig
+ default void Main () cil managed
+ {
+ // Method begins at RVA 0x20f0
+ .entrypoint
+ // Code size 29 (0x1d)
+ .maxstack 2
+ .locals init (
+ valuetype X V_0,
+ valuetype X V_1)
+ IL_0000: ldloca.s 0
+ IL_0002: initobj X
+ IL_0008: ldloc.0
+ IL_0009: stloc.1
+ .try { // 0
+ IL_000a: leave IL_001c
+
+ } // end .try 0
+ finally { // 0
+ IL_000f: ldloc.1
+ IL_0010: brfalse IL_001b
+
+ IL_0015: ldloc.1
+ IL_0016: callvirt instance void class
+[mscorlib]System.IDisposable::Dispose()
+ IL_001b: endfinally
+ } // end handler 0
+ IL_001c: ret
+ } // end of method X::default void Main ()
+
+ } // end of class X