[Mono-bugs] [Bug 49011][Min] Changed - mcs does not report CS0221

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 27 Nov 2003 00:05:23 -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 miguel@ximian.com.

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

--- shadow/49011	2003-09-29 05:37:03.000000000 -0400
+++ shadow/49011.tmp.18638	2003-11-27 00:05:23.000000000 -0500
@@ -2,13 +2,13 @@
 Product: Mono/MCS
 Version: unspecified
 OS: Debian Woody
 OS Details: 
 Status: NEW   
 Resolution: 
-Severity: 
+Severity: Unknown
 Priority: Minor
 Component: Misc
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: vargaz@freemail.hu               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
@@ -30,6 +30,21 @@
         static void Main () {
                 System.Console.WriteLine ((int)double.NaN);
         }
 }
 
 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+------- Additional Comments From miguel@ximian.com  2003-11-27 00:05 -------
+I found that CSC allows values up to 2047 to be cast into a byte, any
+values bigger than that are flagged as an error, ie:
+
+const double d = 2047;
+byte b = (byte) b;
+
+I do not understand exactly the nature of the problem yet (when is a
+cast of a constant allowed in this case, and when not). 
+
+If this is a bug in CSC, the fix is very simple, the code lives in
+Mono.CSharp.Cast.TryReduce () (defined in expression.cs) and we just
+need to repeat the pattern for double and float that we do for the
+other integral types.