[Mono-bugs] [Bug 497421] New: string type is considered valid for new() generic constraint by gmcs from mono 2.2

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Apr 22 14:11:41 EDT 2009


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: mono-bugs at lists.ximian.com
        ReportedBy: grishakin_a at mail.ru
         QAContact: mono-bugs at lists.ximian.com
          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.


More information about the mono-bugs mailing list