[Mono-bugs] [Bug 34161][Maj] Changed - implicit conversion with enums values issue

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
17 Nov 2002 17:16:00 -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 martin@ximian.com.


--- shadow/34161	Sun Nov 17 09:06:02 2002
+++ shadow/34161.tmp.10953	Sun Nov 17 12:16:00 2002
@@ -2,14 +2,14 @@
 Product: Mono/MCS
 Version: unspecified
 OS: other
 OS Details: 
 Status: ASSIGNED   
-Severity: Unknown
-Priority: Blocker
+Severity: 040 One week
+Priority: Major
 Component: Misc
 AssignedTo: martin@ximian.com                            
 ReportedBy: lupus@ximian.com               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
@@ -35,7 +35,22 @@
 I assume this is the
 System.Security.Cryptography/MiniParser.cs(256) error CS0029: Cannot convert implicitly from `int' to `System.UInt16'
 Thanks for the testcase, I was unable to trigger the problem ....
+------- Additional Comments From martin@ximian.com  2002-11-17 12:16 -------
+Ok, this is a bit difficult.  Already posted a workaround to mono-hackers.
+The problem is the following:
+When doing `(ushort)a << 4', the left-hand side is casted to `int' because the left-shift operator operates on ints.
+This means that the expression has a type of `int'.
+When assigning this expression, Assign.DoResolve doesn't know that the expression was initially of type ushort and that the implicit 
+conversion to ushort is allowed.
+As a workaround, explicitly cast the whole expression to short.  Since this problem requires some thinking and there's a simple 
+workaround, setting priority to major.