[Mono-bugs] [Bug 389624] New: gmcs error CS0029: Cannot implicitly convert type `T' to `T'

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue May 13 01:04:52 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=389624


           Summary: gmcs error CS0029: Cannot implicitly convert type `T' to
                    `T'
           Product: Mono: Compilers
           Version: 1.9.0
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: petee at mindtouch.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


The attached code does not compile.  Note, this may be a duplicate of bug:
https://bugzilla.novell.com/show_bug.cgi?id=325069


class Test {
    delegate void Handler();

    static T Foo<T>() where T : new() {
        T result = default(T);
        Bar(delegate() {

            // ACTUAL: bug-002.cs(9,13): error CS0029: Cannot implicitly
convert type `T' to `T'
            result = new T();
        });
        return result;
    }

    static void Bar(Handler h) {
        h();
    }

    static void Main(string[] args) {
        Foo<object>();
    }
}


---
frog:mono-tests petee$ gmcs bug-002.cs 
bug-002.cs(9,13): error CS0029: Cannot implicitly convert type `T' to `T'
bug-002.cs(9,13): The generic parameter `T' of
`Test.<>c__CompilerGenerated0<T>' cannot be converted to the generic parameter
`T' of `Test.Foo<T>()' (in the previous error)
Compilation failed: 1 error(s), 0 warnings


-- 
Configure bugmail: https://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