You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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[]
}
---
The text was updated successfully, but these errors were encountered:
verylonglogin.reg commented on 2014-05-26T13:23:47Z
(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;
}
---
Denis Shelomovskii (@denis-sh) reported this on 2014-04-04T06:37:07Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=12519
Description
The text was updated successfully, but these errors were encountered: