[Mono-bugs] [Bug 359789] New: mcs/gmcs treat & like &&

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Feb 7 19:04:26 EST 2008


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


           Summary: mcs/gmcs treat & like &&
           Product: Mono: Compilers
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: s-kiess at web.de
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


mcs and gmcs treat the boolean logical operator & like the boolean conditional
logical operators &&.

The C# spec however requires that both arguments are evaluated for & (see
14.10.3 and 14.11) which is what csc does.

The | operator is treated correctly.

Test programm:
public class M {
  public static bool g() {
    System.Console.WriteLine ("A");
    return false;
  }

  public static void Main() {
    System.Console.WriteLine (false & g());
    System.Console.WriteLine (true | g());
  }
}

Output when compiled with mcs/gmcs:
False
A
True

Output when compiled with csc:
A
False
A
True


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