[Mono-bugs] [Bug 348255] Bug in turnary operator + nullable types

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Dec 23 09:39:03 EST 2007


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

User alan.mcgovern at gmail.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=348255#c2





--- Comment #2 from Alan McGovern <alan.mcgovern at gmail.com>  2007-12-23 07:39:02 MST ---
I'm confused. Will you grant me that the following two pieces of code are
equivalent:

if (foo)
   return 1;
else
   return 2;


and

return foo ? 1 : 2;

If that is the case, then why does the first code segment i pasted up above not
compile, while this (identical) piece of code below does compile. The only
difference is that in case 1 (above) i used turnary style, whereas in case 2
(below) i used if/else:

using System;
using System.Runtime.InteropServices;

namespace Test
{
        public struct Album
        {       
                public int a;
                public Album? Next
                {
                        get
                        {
                                if(a == 1)
                                        return null;
                                else
                                        return new Album();
                        }
                }
        }

        public class MainClass
        {
                public static void Main(string[] args)
                {

                }
        }
}


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