[Mono-bugs] [Bug 81500][Wis] New - Compilation error with as and ?? operator

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Apr 30 23:19:16 EDT 2007


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 sanxiyn at gmail.com.

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

--- shadow/81500	2007-04-30 23:19:16.000000000 -0400
+++ shadow/81500.tmp.22778	2007-04-30 23:19:16.000000000 -0400
@@ -0,0 +1,50 @@
+Bug#: 81500
+Product: Mono: Compilers
+Version: 1.2
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: sanxiyn at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Compilation error with as and ?? operator
+
+Steps to reproduce the problem:
+
+public class test {
+    public string method(object arg) {
+        string result = arg as string ?? "";
+        return result;
+    }
+}
+
+Actual Results:
+
+$ gmcs -t:library test.cs
+test.cs(3,44): error CS1002: Expecting `;'
+Compilation failed: 1 error(s), 0 warnings
+
+Expected Results:
+
+No error. (csc compiles, and the code looks valid to me.)
+
+Additional Information:
+
+This blocks IronPython 2.0a1 from compiling.
+
+gmcs -t:library -t:library -out:../Bin/Debug/Microsoft.Scripting.dll
+-recurse:Microsoft.Scripting/*.cs
+Microsoft.Scripting/LanguageContext.cs(187,73): error CS1002: Expecting `;'
+Compilation failed: 1 error(s), 0 warnings
+
+One workaround is to parenthesis as operator:
+
+-string result = arg as string ?? "";
++string result = (arg as string) ?? "";


More information about the mono-bugs mailing list