[Mono-bugs] [Bug 79703][Nor] New - Gmcs incorrectly raises CS0452 despite where clause

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Oct 19 21:29:07 EDT 2006

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 brian at fluggo.com.


--- shadow/79703	2006-10-19 21:29:06.000000000 -0400
+++ shadow/79703.tmp.19901	2006-10-19 21:29:06.000000000 -0400
@@ -0,0 +1,56 @@
+Bug#: 79703
+Product: Mono: Compilers
+Version: 1.1
+OS: GNU/Linux [Other]
+OS Details: 
+Status: NEW   
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: brian at fluggo.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: Gmcs incorrectly raises CS0452 despite where clause
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+gmcs incorrectly produces error CS0452 where a type parameter restriction
+ensures that the parameter is a reference type. There appears to be no
+Steps to reproduce the problem:
+Compile the following code with gmcs (r66822):
+namespace Test {
+    class Cache<T> where T : class {
+    }
+    class Base {
+    }
+    class MyType<T> where T : Base {
+        Cache<T> _cache;   // CS0452
+    }
+Actual Results:
+gmcs produces error CS0452 at line 9:
+error CS0452: The type `T' must be a reference type in order to use it as
+type parameter `T' in the generic type or method `Test.Cache<T>'.
+Expected Results:
+The code should compile fine. The fact that T must derive from the Base
+class ensures that it is a reference type.
+How often does this happen? 
+Every time.

More information about the mono-bugs mailing list