[Mono-bugs] [Bug 31783][Nor] New - mcs allows the expression 'e as T' where T is not a reference type

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
5 Oct 2002 06:33:56 -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 mathpup@mylinuxisp.com.

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

--- shadow/31783	Sat Oct  5 02:33:56 2002
+++ shadow/31783.tmp.20088	Sat Oct  5 02:33:56 2002
@@ -0,0 +1,65 @@
+Bug#: 31783
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mathpup@mylinuxisp.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: mcs allows the expression 'e as T' where T is not a reference type
+
+Description of Problem:      
+      
+According to the C# ECMA document, section 14.9.10, in the expression "e     
+as T", T must be a reference type. However, mcs does not indicate an error     
+or warning when this requirement is violated.     
+      
+Steps to reproduce the problem:      
+1. Run the program below     
+     
+using System;    
+    
+public class Testing    
+{    
+	public static void Main()    
+	{    
+		object x = 4;    
+		    
+		if ( x as int == 4 )    
+			Console.WriteLine("4 equals 4");    
+		else    
+			Console.WriteLine("4 doesn't equal 4");    
+	}    
+}     
+ 
+    
+    
+Actual Results:      
+   
+Successful compilation. Running the program results in the output, "4  
+doesn't equal 4".  
+ 
+ 
+      
+Expected Results:      
+  
+Error message as compile-time along the lines of 
+ 
+as-operator.cs:9: reference type required 
+  
+  
+      
+How often does this happen?       
+ 
+Always      
+  
+ 
+Additional Information: