[Issue 21036] wrong code for non-pod types when compiled function with variadic static array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 13 12:12:02 UTC 2021


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

kinke <kinke at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kinke at gmx.net

--- Comment #3 from kinke <kinke at gmx.net> ---
It works as expected with an explicit array literal, i.e.:

void main()
{
    bar([S.init, S.init]);
}

In that case, the AST contains an ArrayLiteralExp with 2 StructLiteralExp
elements.

In the problematic case, the generated ArrayLiteralExp contains 2 temporaries -
apparently for destruction, but the 2 elements are both rvalues and are
supposed to be moved, so no destruction/temporaries necessary.

--


More information about the Digitalmars-d-bugs mailing list