https://issues.dlang.org/show_bug.cgi?id=15965
--- Comment #1 from Kenji Hara <[email protected]> --- First, is the summary "[REG 2.070] ..." a mistake of REG-master (or REG-devel, etc)? You've said: > This used to compile up until 2.071.0, where it broke. So the *issue* exists only in current master branch that not yet released as 2.072. ---- The displayed error with git-head dmd is: test.d(4): Error: struct test.Element no size because of forward reference And yes it is an intentional change. Until 2.071, an use of 'offsetof' property during declarations of instance fields has returned 0 always. Next is an example of the bug: struct Element { ubyte x; // add a field before Element.val public ubyte[256] val; // printed 0 until 2.071, it was incorrect pragma(msg, "1: ", val.offsetof); private ubyte[(val.offsetof + 256) % size_t.sizeof] _padding; } // After Element struct fields are determined, offsetof can return correct result pragma(msg, "2: ", Element.val.offsetof); // If val.offsetof correctly returned 1 during declaration of _padding, // this pragma(msg) would have printed 1, but actually it printed 0... pragma(msg, Element._padding.sizeof); To disallow use of incorrect offsetof value, the "no size bevause of ..." error was introduced. ---- Although the master change is intentional, I still think compiler would be able to supply correct offset value in the OP case. In other words, I think we can change this issue to an enhancement request. --
