www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21315] New: TypeInfo_StaticArray.swap is broken

https://issues.dlang.org/show_bug.cgi?id=21315

          Issue ID: 21315
           Summary: TypeInfo_StaticArray.swap is broken
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: n8sh.secondary hotmail.com

Example code:
---
void main()
{
    import std.stdio;
    int[16] a = 1;
    int[16] b = 2;
    typeid(int[16]).swap(&a, &b);
    writeln(a);
    writeln(b);
}
---

Expected output:
[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]

Actual output:
[2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1]
[1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2]

--
Oct 15 2020