[Mono-bugs] [Bug 23414] New - Usage of ~ does not implicitly promote operand

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
14 Apr 2002 13:06:43 -0000


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 mwh@sysrq.dk.

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

--- shadow/23414	Sun Apr 14 09:06:43 2002
+++ shadow/23414.tmp.16485	Sun Apr 14 09:06:43 2002
@@ -0,0 +1,54 @@
+Bug#: 23414
+Product: Mono/MCS
+Version: unspecified
+OS: other
+OS Details: LFS
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Critical
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mwh@sysrq.dk               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Usage of ~ does not implicitly promote operand
+
+Description of Problem:
+
+sbyte, byte, short, ushort does not get implicitly promoted when using
+bitwise not.
+
+Steps to reproduce the problem:
+
+Code example:
+
+using System;
+
+public class Test {
+    public static void Main (string[] args) {
+	sbyte bitNot = 0;
+	bitNot = (sbyte)(~bitNot); // bitNot does not get promoted to int
+        bitNot = (sbyte)(~(int)bitNot); // this explicit promotion works.
+	Console.WriteLine ("Bitwise Not: {0}", bitNot);
+    }
+
+}
+
+Actual Results:
+
+error CS23: Operator ~ cannot be applied to operand of type `sbyte'
+
+Expected Results:
+
+RESULT: 0
+
+How often does this happen? 
+
+Every time I try to compile the code ;)
+
+Additional Information:
+
+N/A