Bug 318469 (MONO75492) - [GMCS] CS0310 not reported when creating generic type with new() contraint
Summary: [GMCS] CS0310 not reported when creating generic type with new() contraint
Status: RESOLVED FIXED
Alias: MONO75492
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.0
Hardware: Other Other
: P3 - Medium : Minor
Target Milestone: ---
Assignee: Martin Baulig
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-06 20:47 UTC by Kamil Skalski
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 19:24:31 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".