http://bugzilla.novell.com/show_bug.cgi?id=497421


           Summary: string type is considered valid for new() generic
                    constraint by gmcs from mono 2.2
    Classification: Mono
           Product: Mono: Compilers
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: [email protected]
        ReportedBy: [email protected]
         QAContact: [email protected]
          Found By: ---


Description of Problem:


Steps to reproduce the problem:
1. Compile following code.
2. Then run

using System;
using System.Diagnostics;

public static class Program
{
    static void Main()
    {
        var x = new object[]
        {
            Ret<int>(), Ret<float>(), Ret<bool>(), Ret<DateTime>(), 
            Ret<float>(), Ret<string>()
        };

        Console.WriteLine(string.Join(", ", 
            Array.ConvertAll<object, string>(x, Convert.ToString)));
    }

    static T Ret<T>() where T: new()
    {
        return new T();
    }
} 

Actual Results:
Runtime exception

Expected Results:
Shoudn't compile

How often does this happen? 
always

Additional Information:

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to