https://issues.dlang.org/show_bug.cgi?id=16508
--- Comment #6 from Max Samukha <[email protected]> --- (In reply to kinke from comment #5) > (In reply to Max Samukha from comment #4) > > I'm curious why you chose to nitpick - it's unlikely you didn't understand > > what I meant. > > Just stumbled upon this issue and wanted to correct this - > `classInstanceSize` doesn't need a fix. > > > Class instance types exist implicitly and are commonly represented by > > structs. The return type of std.typecons.scoped is an example, as you know. > > It is reasonable to expect arrays (and, in general, sequentially stored > > objects) of such structs to be usable. > > A field like `align(C.alignof) void[__traits(classInstanceSize, C)] buffer` > should make sure there's appropriate padding, solely based on the align > declaration, which is required anyway and apparently does need fixing. (I assume you meant align(classInstanceAlignment!C), which currently produces wrong results due to this bug) I'm sorry to disagree. __traits(classInstanceSize) should return the stride of an array of class instances, similarly to what .sizeof does for structs. --
