[Mono-bugs] [Bug 37358][Nor] Changed - mcs believes that System.Enum is a value type

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Wed, 29 Jan 2003 02:16:18 -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 mathpup@mylinuxisp.com.

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

--- shadow/37358	Wed Jan 29 01:34:00 2003
+++ shadow/37358.tmp.6038	Wed Jan 29 02:16:18 2003
@@ -1,14 +1,14 @@
 Bug#: 37358
 Product: Mono/MCS
 Version: unspecified
-OS: 
+OS: unknown
 OS Details: 
 Status: NEW   
 Resolution: 
-Severity: 
+Severity: Unknown
 Priority: Normal
 Component: Misc
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: mathpup@mylinuxisp.com               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
@@ -54,6 +54,28 @@
 Additional Information:
 
 ------- Additional Comments From mathpup@mylinuxisp.com  2003-01-29 01:33 -------
 Created an attachment (id=3268)
 Test case
 
+
+------- Additional Comments From mathpup@mylinuxisp.com  2003-01-29 02:16 -------
+I found the problem and a fix. The method As.DoResolve() calls 
+TypeManager.IsValueType to see if the type following "as" is a value type. The 
+code in TypeManager.IsValueType simply assumes that any types that are 
+subclasses of System.ValueType are value types, but that is not true of 
+System.Enum. That is, System.Enum a subclass of System.ValueType, but 
+System.Enum is a reference type. 
+ 
+Changing the test from 
+ 
+	if (t.IsSubclassOf (TypeManager.value_type)) 
+ 
+to 
+	if (t.IsSubclassOf (TypeManager.value_type) && (t != TypeManager 
+.enum_type)) 
+ 
+fixes the problem. 
+ 
+I'm attaching a patch file. 
+ 
+