[Mono-bugs] [Bug 52933][Nor] New - mcs incorrectly inserts finalizer boilerplace in Finalize methods

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 16 Jan 2004 06:37:04 -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 lupus@ximian.com.

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

--- shadow/52933	2004-01-16 06:37:03.000000000 -0500
+++ shadow/52933.tmp.8658	2004-01-16 06:37:03.000000000 -0500
@@ -0,0 +1,77 @@
+Bug#: 52933
+Product: Mono/Compilers
+Version: unspecified
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: lupus@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: mcs incorrectly inserts finalizer boilerplace in Finalize methods
+
+The following examples are miscompiled by mcs. It inserts
+the try block and the call to the parent finalizer, even if the emthods are
+no destructors.
+
+using System;
+
+public class A {
+ public A() {
+  Console.WriteLine( "Object a created!" );
+ }
+ public static void Finalize() {
+  Console.WriteLine( "Object a finalized!" );
+ }
+}
+
+public class B {
+ public static void Main( string[] args ) {
+  A a = new A();
+  A.Finalize();
+ }
+}
+
+Example2:
+using System;
+
+public class A {
+ public A() {
+  Console.WriteLine( "Object a created!" );
+ }
+ public void Finalize(int a) {
+  Console.WriteLine( "Object a finalized!" );
+ }
+}
+
+public class B {
+ public static void Main( string[] args ) {
+  A a = new A();
+  a.Finalize(1);
+ }
+}
+
+Example 3:
+using System;
+
+public class A {
+ public A() {
+  Console.WriteLine( "Object a created!" );
+ }
+ public void Finalize() {
+  Console.WriteLine( "Object a finalized!" );
+ }
+}
+
+public class B {
+ public static void Main( string[] args ) {
+  A a = new A();
+  a.Finalize();
+ }
+}