[Issue 21368] New: copy-constructors aren't called for static arrays
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Sat Nov  7 09:05:06 UTC 2020
    
    
  
https://issues.dlang.org/show_bug.cgi?id=21368
          Issue ID: 21368
           Summary: copy-constructors aren't called for static arrays
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ilyayaroshenko at gmail.com
struct S
{
    int* data;
@safe pure nothrow @nogc:
    this(ref return scope inout typeof(this)) inout{
        pragma(inline, false);
    }
}
S[3] foo(ref S[3] r)
{
    return r;
}
/// just copies memory and don't call S.__ctor
example.S[3] example.foo(ref example.S[3]):
        mov     rax, rdi
        mov     rcx, qword ptr [rsi + 16]
        mov     qword ptr [rdi + 16], rcx
        vmovups xmm0, xmmword ptr [rsi]
        vmovups xmmword ptr [rdi], xmm0
        ret
please make fix work with -betterC
Thanks
--
    
    
More information about the Digitalmars-d-bugs
mailing list