[Mono-bugs] [Bug 72326][Nor] New - [GMCS] Error CS0453 reported on valid code

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 7 Feb 2005 21:39:42 -0500 (EST)


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 mtreiber@gmail.com.

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

--- shadow/72326	2005-02-07 21:39:42.000000000 -0500
+++ shadow/72326.tmp.30372	2005-02-07 21:39:42.000000000 -0500
@@ -0,0 +1,44 @@
+Bug#: 72326
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mtreiber@gmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [GMCS]  Error CS0453 reported on valid code
+
+gmcs reports error CS0453 (type 'T' must be a value type ...) when a generic class implements a 
+generic interface where the generic type is limited to a struct.  The test code below passes on 
+Visual C# Express but reports the same errors on both gmcs 1.1.3 and 1.1.4.20050204 
+snapshots.
+
+
+using System;
+
+public interface IA<T> where T : struct {
+
+}
+
+public class B<T> : IA<T> where T:struct {
+
+}
+
+public class MainClass {
+        public static void Main () {}
+
+}
+
+compiling with "gmcs -out:test.exe test.cs" produces the following output:
+
+test.cs(7) error CS0453: The type `T' must be a value type in order to use it as type parameter 
+`T' in the generic type or method `IA`1<T>'.
+Compilation failed: 1 error(s), 0 warnings