[Mono-bugs] [Bug 76267][Wis] New - [GMCS] using the as operator with a generic parameter

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Sep 28 22:58:05 EDT 2005


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 duncan at ximian.com.

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

--- shadow/76267	2005-09-28 22:58:05.000000000 -0400
+++ shadow/76267.tmp.32376	2005-09-28 22:58:05.000000000 -0400
@@ -0,0 +1,40 @@
+Bug#: 76267
+Product: Mono: Compilers
+Version: 1.0
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: duncan at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [GMCS] using the as operator with a generic parameter
+
+Here's a test case:
+
+public class Foo<T> {
+	public T Do (object o) { return o as T; }
+}
+
+class Driver {
+	static void Main ()
+	{
+		Foo<int> f = new Foo<int> ();
+		f.Do ("something");
+	}
+}
+
+Expected: 
+generic-as.cs(2,34): error CS0413: The type parameter 'T' cannot be used
+with the 'as' operator because it does not have a class type constraint nor
+a 'class' constraint
+
+Actual:
+
+Compilation Finished.


More information about the mono-bugs mailing list