[Mono-bugs] [Bug 74510][Cos] New - mcs throws exception for == operator not specified static

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 8 Apr 2005 07:24:05 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by nazgul@omega.pl.

http://bugzilla.ximian.com/show_bug.cgi?id=74510

--- shadow/74510	2005-04-08 07:24:05.000000000 -0400
+++ shadow/74510.tmp.27808	2005-04-08 07:24:05.000000000 -0400
@@ -0,0 +1,72 @@
+Bug#: 74510
+Product: Mono: Compilers
+Version: 1.0
+OS: 
+OS Details: mono 1.1.6
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Cosmetic
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: nazgul@omega.pl               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: mcs throws exception for == operator not specified static
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+mcs throws exception after signaling error message
+
+Steps to reproduce the problem:
+1. Try to compile following errornous code:
+
+using System;
+
+class X {
+  public bool operator == (X a, X b) { return true; } 
+
+  public static bool operator != (X a, X b) { return false; } 
+  
+    static void Main ()
+    {
+      X a = new X();
+      Console.WriteLine (a == null);
+    }
+}
+
+
+Actual Results:
+t.cs(4) error CS0558: User defined operators 'X.operator == bool(X,X)' must
+be declared static and public
+
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in <0x00029>
+Mono.CSharp.TypeContainer+OperatorArrayList+OperatorEntry:.ctor (Int32 f,
+Mono.CSharp.Operator o)
+in <0x00181>
+Mono.CSharp.TypeContainer+OperatorArrayList:CheckPairedOperators ()
+in <0x00016>
+Mono.CSharp.TypeContainer+OperatorArrayList:DefineContainerMembers ()
+in <0x00014> Mono.CSharp.TypeContainer:DefineContainerMembers
+(Mono.CSharp.MemberCoreArrayList mcal)
+in <0x0046f> Mono.CSharp.TypeContainer:DoDefineMembers ()
+in <0x0002a> Mono.CSharp.TypeContainer:DefineMembers
+(Mono.CSharp.TypeContainer container)
+in <0x000fa> Mono.CSharp.RootContext:PopulateTypes ()
+in <0x00b15> Mono.CSharp.Driver:MainDriver (System.String[] args)
+in <0x0000f> Mono.CSharp.Driver:Main (System.String[] args)
+
+
+Expected Results:
+t.cs(4) error CS0558: User defined operators 'X.operator == bool(X,X)' must
+be declared static and public
+
+How often does this happen? 
+Always
+
+Additional Information: