[Mono-bugs] [Bug 478655] New: delegate: Can not compute type of conditional expression

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Feb 23 07:55:00 EST 2009


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


           Summary: delegate: Can not compute type of conditional
                    expression
    Classification: Mono
           Product: Mono: Compilers
           Version: SVN
          Platform: x86
        OS/Version: UNIX Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: spigaz at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux i686; pt-PT; rv:1.9.0.6)
Gecko/2009020410 Fedora/3.0.6-1.fc10 Firefox/3.0.6

Can't process properly an inline if when the else is null. It used to work when
casting the null to the delegate type.

Reproducible: Always

Steps to Reproduce:
1. Try to compile this (this worked till recently):
public delegate ADelegate ADelegate(bool ok);

public class A
{
    public static ADelegate Delegate2(bool ok)
    {
        return ok ? Delegate2 : ((ADelegate)null);
    }
}

2. The proper code is (didn't compiled either):
public delegate ADelegate ADelegate(bool ok);

public class A
{
    public static ADelegate Delegate2(bool ok)
    {
        return ok ? Delegate2 : null;
    }
}
3.
Actual Results:  
delegate.cs(8,24): error CS0172: Can not compute type of conditional expression
as `A' and `ADelegate' convert implicitly to each other

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