https://issues.dlang.org/show_bug.cgi?id=18029
ilya.ya...@gmail.com changed:
What|Removed |Added
CC||ilya.ya...@gmail.com
--- Comment #1 from ilya.ya...@gmail.com ---
The arguments are most definitely copied, one can easily see that by taking the
addresses of `vals[0]` and `a0` respectively. The spec is also pretty clear
that the contents of the array is invalid after the function exits, see 5.
here:
https://docarchives.dlang.io/v2.076.0/spec/function.html#typesafe_variadic_functions
So, that a0 remains unchanged is not really a mystery.
It is weird though, that neither copy constructor nor postblit is called (I
tried adding a copy constructor), probably some kind of optimization? But
should we require typed varargs to always be const then?
Then, the default opAssign calls the destructor on the lvalue being assigned.
That seems to be correct, but since the value was never constructed, this
causes a disparity in constructor/destructor calls you observe.
--