Bugzilla – Bug 318469
[GMCS] CS0310 not reported when creating generic type with new() contraint
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by nazgul@omega.pl 2005-07-06 13:47:05 MST ---- 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: ---- Additional Comments From martin@ximian.com 2005-07-11 12:37:59 MST ---- Fixed in SVN. ---- Additional Comments From martin@ximian.com 2005-07-11 12:38:40 MST ---- . Unknown bug field "cf_op_sys_details" encountered while moving bug <cf_op_sys_details>mono svn</cf_op_sys_details> Unknown operating system unknown. Setting to default OS "Other".