https://issues.dlang.org/show_bug.cgi?id=17220
Stefan Koch changed:
What|Removed |Added
Hardware|x86 |x86_64
--- Comment #1 from Stefan Koch ---
Happens on 64bit as well
Slightly modified:
void emitArithInstruction2(BCValue lhs)
{
if (lhs.type != BCTypeEnum.i32) // type get's overwritten
assert(0);
}
enum BCTypeEnum : ubyte
{
Undef,
i32 = 8, // value must be >= 8
}
struct BCValue // size must be size_t.sizeof x BCTypeEnum.i32
{
BCTypeEnum type; // position doesn't matter
ubyte[size_t.sizeof * BCTypeEnum.i32 - type.sizeof] more;
}
static assert(BCValue.sizeof == size_t.sizeof * BCTypeEnum.i32);
BCValue i32()
{
BCValue result; // must be default 0 initialized
result.type = BCTypeEnum.i32; // set value
return result;
}
void main()
{
auto val = i32();
emitArithInstruction2(val);
}
CODE
--