[Mono-bugs] [Bug 55251][Nor] New - mcs has problems with const enums and casts

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 6 Mar 2004 05:20:17 -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=55251

--- shadow/55251	2004-03-06 05:20:17.000000000 -0500
+++ shadow/55251.tmp.26271	2004-03-06 05:20:17.000000000 -0500
@@ -0,0 +1,63 @@
+Bug#: 55251
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mathpup@mylinuxisp.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: mcs has problems with const enums and casts
+
+Description of Problem: 
+ 
+In a constant initialization expression, mcs flags an error when the  
+expression involves a cast from an integer that does not correspond to an 
+ordinal value of the enum: 
+ 
+using System; 
+ 
+ 
+public class Testing 
+{ 
+    public enum INT : int { Zero } 
+    public const INT JPEG_SUSPENDED = (INT)0; 
+    public const INT JPEG_HEADER_OK = (INT)1; 
+    public const INT JPEG_HEADER_TABLES_ONLY = (INT)2; 
+ 
+    public static void Main() 
+    { 
+ 
+    } 
+} 
+ 
+ 
+Steps to reproduce the problem: 
+1. mcs whatever.cs 
+ 
+ 
+Actual Results: 
+ 
+agc.cs(8) error CS0150: A constant value is expected 
+agc.cs(9) error CS0150: A constant value is expected 
+ 
+ 
+ 
+Expected Results: 
+ 
+Successful compilation 
+ 
+ 
+How often does this happen?  
+ 
+Always 
+ 
+ 
+Additional Information: