[Mono-bugs] [Bug 62054][Nor] New - Error on binary or in case statements
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Wed, 28 Jul 2004 13:08:29 -0400 (EDT)
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 alfredo@lab.matcom.uh.cu.
http://bugzilla.ximian.com/show_bug.cgi?id=62054
--- shadow/62054 2004-07-28 13:08:29.000000000 -0400
+++ shadow/62054.tmp.12001 2004-07-28 13:08:29.000000000 -0400
@@ -0,0 +1,35 @@
+Bug#: 62054
+Product: Mono: Compilers
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: alfredo@lab.matcom.uh.cu
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Error on binary or in case statements
+
+Description of Problem:
+I'm not sure if this is exactly a bug. The code is written in C#.
+Trying to compile something like this in a swith statement:
+
+case (XMode.X1 | XMode.X2) : {...}
+
+outputs the error:
+"operator |(EnumConstant (1), EnumConstant (2))(CS0150: A constant value is
+expected, got)"
+
+XMode is declared like this:
+public enum XMode : byte{X1 = 1, X2 = 2, X3 = 4, X4 = 8}
+
+I had to solve this converting the switch block to a sequence of ifs. Then
+it worked.
+
+This code compiles and works OK with Visual Studio.