gcc/testsuite/gdc.test/runnable/test19672.d
raw| 1 | // https://issues.dlang.org/show_bug.cgi?id=19672 |
| 2 | |
| 3 | struct S |
| 4 | { |
| 5 | ulong c; |
| 6 | bool b; // removing this prevents bug |
| 7 | } |
| 8 | |
| 9 | // increase the struct size at least to 17 bytes also prevents the bug. |
| 10 | |
| 11 | void main() |
| 12 | { |
| 13 | S[1] a = [S(42)]; |
| 14 | assert(a[0].c == 42); /* Passes. */ |
| 15 | f(a); |
| 16 | } |
| 17 | |
| 18 | void f(S[1] a) |
| 19 | { |
| 20 | assert(a[0].c == 42); /* Fails. */ |
| 21 | } |