This code should compile: --- void main() { void[] va; byte[] ba; byte[1] sba; const byte[] cba; const byte[1] csba; va ~= ba; // ok va ~= sba; // ok va ~= cba; // Error: cannot append type const(byte[]) to type void[] va ~= csba; // Error: cannot append type const(byte[1]) to type void[] } ---
void[] is an array of untyped *mutable* data. So appending const data to mutable array will violate type system.
(In reply to Kenji Hara from comment #1) > void[] is an array of untyped *mutable* data. So appending const data to > mutable array will violate type system. But `byte` has no indirections so `const byte` is convertible to `byte` and this logically equivalent code is valid: --- void main() { void[] va; const byte[] cba; const byte[1] csba; byte[] tmp; tmp ~= cba; tmp ~= csba; va = tmp; } ---
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17650 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB