Comment #0 by dlang-bugzilla — 2021-06-29T07:46:42Z
////////// test.d //////////
struct S
{
S[] sub;
alias sub this;
}
void main()
{
S s;
S[] arr;
arr = arr ~ s;
assert(arr.length == 1);
}
////////////////////////////
The assertion fails. Instead of doing the expected thing and concatenating s to arr, the compiler chooses to concatenate arr with s.sub.
Note that
arr ~= s;
works as expected.
Comment #1 by robert.schadek — 2024-12-13T19:17:25Z