← Back to index
|
Original Bugzilla link
Bug 21368 – copy-constructors aren't called for static arrays
Status
RESOLVED
Resolution
DUPLICATE
Severity
blocker
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-11-07T09:05:06Z
Last change time
2022-02-17T13:39:59Z
Assigned to
No Owner
Creator
Илья Ярошенко
Comments
Comment #0
by ilyayaroshenko — 2020-11-07T09:05:06Z
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
Comment #1
by uplink.coder — 2020-11-24T12:40:52Z
It's coming from a ref. What makes you think that any ctor should be called?
Comment #2
by ilyayaroshenko — 2020-11-24T12:41:55Z
(In reply to Stefan Koch from comment #1) > It's coming from a ref. > > What makes you think that any ctor should be called? It is returned by value.
Comment #3
by razvan.nitu1305 — 2022-02-17T13:39:59Z
*** This issue has been marked as a duplicate of issue 20365 ***