[Mono-bugs] [Bug 53696][Min] New - CS0029: shift operator casts the result value as larger right operand type

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 1 Feb 2004 06:27:57 -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 atsushi@ximian.com.

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

--- shadow/53696	2004-02-01 06:27:57.000000000 -0500
+++ shadow/53696.tmp.9733	2004-02-01 06:27:57.000000000 -0500
@@ -0,0 +1,46 @@
+Bug#: 53696
+Product: Mono/Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: atsushi@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: CS0029: shift operator casts the result value as larger right operand type
+
+csc treats the return type of "short >>= int" and "short <<= int" as 
+short. mcs treats them as int.
+
+using System;
+
+public class Test
+{
+        public static void Main ()
+        {
+                short s = 5;
+                int i = 30000001;
+                s <<= i;
+                Console.WriteLine (s);
+        }
+}
+
+Actual Results:
+
+mcs shortshr.cs
+shortshr.cs(9) error CS0029: Cannot convert implicitly from `int' to 
+`short'
+Compilation failed: 1 error(s), 0 warnings
+
+Expected Results:
+compile successfully.
+
+How often does this happen? 
+always