[Mono-bugs] [Bug 81505][Nor] New - When using an as the ?? operator is not using the correct associativity

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue May 1 11:54:49 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 slide.o.mix at gmail.com.

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

--- shadow/81505	2007-05-01 11:54:49.000000000 -0400
+++ shadow/81505.tmp.16462	2007-05-01 11:54:49.000000000 -0400
@@ -0,0 +1,61 @@
+Bug#: 81505
+Product: Mono: Compilers
+Version: 1.2
+OS: GNU/Linux [Other]
+OS Details: Gentoo Linux 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: slide.o.mix at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: When using an as the ?? operator is not using the correct associativity
+
+Description of Problem:
+While compiling IronPython 2.0 alpha using gmcs, the following code caused
+a compiler error.
+
+using System;
+
+
+public class Program
+{
+    public static int Main(string[] args)
+    {
+        Console.WriteLine(DoSomething("moo!"));
+        Console.WriteLine(DoSomething(new Exception("foo")));
+        return 0;
+    }
+
+    public static Exception DoSomething(object value)
+    {
+        return value as Exception ?? new Exception(value.ToString());
+    }
+}
+
+test.cs(14,69): error CS1002: Expecting `;'
+Compilation failed: 1 error(s), 0 warnings
+
+If I add parenthesis around the as clause "(value as Exception)", the
+compiler does not return an error.
+
+Steps to reproduce the problem:
+1. create program with an as expression inside of an ?? expression
+2. compile with gmcs 
+3. get compiler error
+
+Actual Results:
+Compiler error that the compiler is expecting a ; where the ?? is.
+
+Expected Results:
+Successful compilation (this works on MS compiler)
+
+How often does this happen? 
+All the time
+
+Additional Information:


More information about the mono-bugs mailing list