mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-09 20:37:25 +03:00

Unnaturally aligned aggregates were potentially not marked as packed, leading to LLVM inserting additional padding and screwing up the memory layout.
29 lines
429 B
D
29 lines
429 B
D
// RUN: %ldc -output-ll -of=%t.ll %s && FileCheck %s < %t.ll
|
|
// RUN: %ldc -run %s
|
|
|
|
// CHECK: %gh2235.Foo = type <{
|
|
align(2) struct Foo {
|
|
long y;
|
|
byte z;
|
|
}
|
|
|
|
// CHECK: %gh2235.Bar = type <{
|
|
class Bar {
|
|
union {
|
|
bool b;
|
|
Foo foo;
|
|
}
|
|
byte x;
|
|
|
|
void set(Foo f) {
|
|
x = 99;
|
|
foo = f;
|
|
}
|
|
}
|
|
|
|
void main() {
|
|
Bar bar = new Bar();
|
|
Foo f;
|
|
bar.set(f);
|
|
assert(bar.x == 99);
|
|
}
|