```
void check(void[] v, size_t len)
{
import std.conv;
assert(v.length == len,
"v.length is " ~ v.length.to!string ~
", expected " ~ len.to!string);
}
int implicitConversion()
{
int[2] arr;
check(arr, 8);
return 42;
}
int noConversion()
{
ubyte[8] arr;
check(arr, 8);
return 42;
}
struct S
{
int i = implicitConversion; // Error: "v.length is 2, expected 8"
int j = noConversion; // Fine
}
void main()
{
int i = implicitConversion; // Fine
int j = noConversion; // Fine
}
```
This problem surfaced while trying do statically initialize an instance of std.bitmanip.BitArray.
Comment #1 by b2.temp — 2024-03-27T13:37:09Z
compile-time evaluation bug. minimized to
```d
enum int[2] a = [0,1];
static assert((cast(void[])a).length == 8);
```
Comment #2 by robert.schadek — 2024-12-13T19:34:07Z