[Mono-bugs] [Bug 659022] New: null-coalescing operator and the null keyword: not properly typed

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Dec 12 08:46:16 EST 2010


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

https://bugzilla.novell.com/show_bug.cgi?id=659022#c0


           Summary: null-coalescing operator and the null keyword: not
                    properly typed
    Classification: Mono
           Product: Mono: Compilers
           Version: SVN
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: msafar at novell.com
        ReportedBy: xtzgzorex at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.19)
Gecko/2010102809 Iceweasel/3.0.6 (Debian-3.0.6-3)

Consider this code:using System;

namespace Test
{
    public static class Program
    {
        private static void Main()
        {
            Exception ex = null ?? new Exception(); // 'null' is not properly
assumed to be of type 'Exception'
        }
    }
}

The compiler will complain with:

Test.cs(9,33): error CS0584: Internal compiler error: Test.cs(9,33):
Mono.CSharp.ReducedExpression+ReducedExpressionStatement ExprClass is Invalid
after resolve
Test.cs(9,23): error CS0266: Cannot implicitly convert type `object' to
`System.Exception'. An explicit conversion exists (are you missing a cast?)

Needless to say, the expression above is rather useless, but this does,
nonetheless, compile with csc.exe (and I believe it's proper code).

Reproducible: Always

Steps to Reproduce:
1. Create Test.cs; paste above code in.
2. Run dmcs Test.cs.
Actual Results:  
Test.cs(9,33): error CS0584: Internal compiler error: Test.cs(9,33):
Mono.CSharp.ReducedExpression+ReducedExpressionStatement ExprClass is Invalid
after resolve
Test.cs(9,23): error CS0266: Cannot implicitly convert type `object' to
`System.Exception'. An explicit conversion exists (are you missing a cast?)

Expected Results:  
Compile the code. ;-)

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list