[Mono-bugs] [Bug 619555] New: Operator error

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Jul 2 10:33:19 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=619555

http://bugzilla.novell.com/show_bug.cgi?id=619555#c0


           Summary: Operator error
    Classification: Mono
           Product: Mono: Runtime
           Version: SVN
          Platform: 64bit
        OS/Version: RHEL 5
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: misc
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: srfcanada at hotmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; WOW64;
Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; MS-RTC LM 8)

the error seems to have appeared in the last couple days checkins. The given
test class doesnt compile on mono but does on windows and used to compile on
mono a few days ago.

1. Test Class:
using System;
using System.Collections.Generic;

namespace Test
{
   internal struct TestClass4<T>  : IEquatable<TestClass4<T>>, IEquatable<T>,
IEqualityComparer<TestClass4<T>> where T : class
   {
      public bool Equals(T obj)
      {
         return true;
      }

      public bool Equals(TestClass4<T> entry)
      {
         return true;
      }

      public bool Equals(TestClass4<T> x, TestClass4<T> y)
      {
         return x.Equals(y);
      }

      public int GetHashCode(TestClass4<T> obj)
      {
         return obj.GetHashCode();
      }

      public override int GetHashCode()
      {
         return 1;
      }

      public override bool Equals(object obj)
      {
         return false;
      }

      public static bool operator ==(TestClass4<T> entry1, TestClass4<T>
entry2)
      {
         return entry1.Equals(entry2);
      }

      public static bool operator ==(T entry1, TestClass4<T> entry2)
      {
         return entry2.Equals(entry1);
      }

      public static bool operator ==(TestClass4<T> entry1, T entry2)
      {
         return entry1.Equals(entry2);
      }

      public static bool operator ==(object entry1, TestClass4<T> entry2)
      {
         return entry2.Equals(entry1);
      }

      public static bool operator ==(TestClass4<T> entry1, object entry2)
      {
         return entry1.Equals(entry2);
      }

      public static bool operator !=(TestClass4<T> entry1, TestClass4<T>
entry2)
      {
         return !(entry1 == entry2);
      }

      public static bool operator !=(T entry1, TestClass4<T> entry2)
      {
         return !(entry1 == entry2);
      }

      public static bool operator !=(TestClass4<T> entry1, T entry2)
      {
         return !(entry1 == entry2);
      }

      public static bool operator !=(object entry1, TestClass4<T> entry2)
      {
         return !(entry1 == entry2);
      }

      public static bool operator !=(TestClass4<T> entry1, object entry2)
      {
         return !(entry1 == entry2);
      }
   }
}


2. compile it:
gmcs /targe:library test4.cs

3. generates this error on mono:
test4.cs(65,26): error CS0019: Operator `==' cannot be applied to operands of
type `Test.TestClass4<T>' and `Test.TestClass4<T>'
test4.cs(70,26): error CS0019: Operator `==' cannot be applied to operands of
type `T' and `Test.TestClass4<T>'
test4.cs(75,26): error CS0019: Operator `==' cannot be applied to operands of
type `Test.TestClass4<T>' and `T'
test4.cs(80,26): error CS0019: Operator `==' cannot be applied to operands of
type `object' and `Test.TestClass4<T>'
test4.cs(85,26): error CS0019: Operator `==' cannot be applied to operands of
type `Test.TestClass4<T>' and `object'
Compilation failed: 5 error(s), 0 warnings


Reproducible: Always

Steps to Reproduce:
1.
2.
3.

-- 
Configure bugmail: http://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