[Mono-bugs] [Bug 75492][Cos] New - [GMCS] CS0310 not reported when creating generic type with new() contraint

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Jul 6 13:47:06 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 nazgul at omega.pl.

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

--- shadow/75492	2005-07-06 13:47:06.000000000 -0400
+++ shadow/75492.tmp.25227	2005-07-06 13:47:06.000000000 -0400
@@ -0,0 +1,58 @@
+Bug#: 75492
+Product: Mono: Compilers
+Version: 1.0
+OS: 
+OS Details: mono svn
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Cosmetic
+Component: C#
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: nazgul at omega.pl               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [GMCS] CS0310 not reported when creating generic type with new() contraint
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+gmcs allows instanciating generic parameter constrained with new() to a
+class without public parameterless constructor
+
+Steps to reproduce the problem:
+1. Compile
+
+class C <a> where a : new () {
+}
+
+class Foo {
+  public Foo (int x) { }
+}
+
+class X
+{
+        static void Main ()
+        {
+          C<Foo> x = new C<Foo>();
+        }
+}
+ 
+
+Actual Results:
+Compiles fine.
+
+Expected Results:
+t.cs(12,11): error CS0310: The type 'Foo' must have a public parameterless
+constructor in order to use it as parameter 'a' in the generic type or
+method 'C<a>'
+t.cs(1,7): (Location of symbol related to previous error)
+t.cs(4,7): (Location of symbol related to previous error)
+
+
+How often does this happen? 
+Always
+
+Additional Information:


More information about the mono-bugs mailing list