[Bug 250] New: Suspicious array comparison behaviour

via D.gnu d.gnu at puremagic.com
Sat Jan 21 08:22:39 PST 2017


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 at gdcproject.org
          Reporter: sebastien.alaiwan at 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.


More information about the D.gnu mailing list