www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Bug 250] New: Suspicious array comparison behaviour

http://bugzilla.gdcproject.org/show_bug.cgi?id=250

            Bug ID: 250
           Summary: Suspicious array comparison behaviour
           Product: GDC
           Version: 6.x
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gdc
          Assignee: ibuclaw gdcproject.org
          Reporter: sebastien.alaiwan gmail.com

The following unittest block fails with gdc (but not with dmd), making me
wonder about the semantics of array-of-struct comparison.

int main() {return 0;}

unittest
{
  struct S
  {
    string data;
  }

  auto a1 = S("hello");
  auto a2 = S("hello".dup);

  assert(a1.data == a2.data); // OK: passes with dmd and gdc
  assert(a1 == a2); // OK: passes with dmd and gdc
  assert([a1] == [a2]); // ERROR: passes with dmd, but not gdc
}

-- 
You are receiving this mail because:
You are watching all bug changes.
Jan 21 2017