[Mono-bugs] [Bug 433701] New: Compiler error with generics and constraints should be improved

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Oct 8 17:48:14 EDT 2008


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


           Summary: Compiler error with generics and constraints should be
                    improved
           Product: Mono: Compilers
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Minor
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: aaragoneses at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


If we try to compile this method:

I Get<I>() { return new object() as I; }

With csc I get: CS0413: The type parameter 'I' cannot be used with the 'as'
operator because it does not have a class type constraint nor a 'class'
constraint

But with gmcs I get: The `as' operator cannot be used with a non-reference type
parameter `I'(CS0413)

Yes, they mean the same, but the csc one gives clues about the solution.


-- 
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