dmd
dmd copied to clipboard
[REG master] Array concatenation with inout compile error
The following code compiled with DMD 2.111:
inout(int[]) test1(inout(int[]) a, int b)
{
return a ~ b;
}
inout(int[]) test2(inout(int[]) a, inout(int[]) b)
{
return a ~ b;
}
void main()
{
test1([1], 2);
test2([1], [2]);
}
With DMD master it results in the following compile error instead:
./generated/linux/release/64/../../../../druntime/import/core/internal/array/casting.d(81): Error: `inout` on `return` means `inout` must be on a parameter as well for `pure @nogc @trusted inout(int)[](return scope void[] from)`
TTo[] __ArrayCast(TFrom, TTo)(return scope TFrom[] from) @nogc pure @trusted
^
./generated/linux/release/64/../../../../druntime/import/core/internal/array/concatenation.d(47): Error: template instance `core.internal.array.casting.__ArrayCast!(void, inout(int))` error instantiating
res = cast(Tret) __arrayAlloc!(UnqT)(elemSize * totalLen);
^
testinoutconcat.d(3): instantiated from here: `_d_arraycatnTX!(inout(int)[], inout(int[]), inout(int))`
return a ~ b;
^
testinoutconcat.d(7): Error: template instance `core.internal.array.concatenation._d_arraycatnTX!(inout(int)[], inout(int[]), inout(int[]))` error instantiating
return a ~ b;
^
cc @Albert24GG
Looks like this may be fixed now.
Yes, it works now. The dlang-bot still only mentions bugzilla issues. I'm not sure how github issues should be mentioned, so they are automatically closed and will be part of the changelog.