I've used zero-length static arrays at the end of structs before, and they work, for the most part. I'm surprised having a zero-length member in the middle of a struct causes an ICE, though. Or is it the zero-length ctor parameter that's causing the problem?
Comment #4 by ilyayaroshenko — 2017-03-30T19:23:21Z
(In reply to hsteoh from comment #3)
> I've used zero-length static arrays at the end of structs before, and they
> work, for the most part. I'm surprised having a zero-length member in the
> middle of a struct causes an ICE, though. Or is it the zero-length ctor
> parameter that's causing the problem?
It is all factors together. No one line can be removed to reduce this example.
Comment #5 by kinke — 2017-03-30T22:02:17Z
(In reply to Илья Ярошенко from comment #4)
> (In reply to hsteoh from comment #3)
> > I've used zero-length static arrays at the end of structs before, and they
> > work, for the most part. I'm surprised having a zero-length member in the
> > middle of a struct causes an ICE, though. Or is it the zero-length ctor
> > parameter that's causing the problem?
>
> It is all factors together. No one line can be removed to reduce this
> example.
We've had the same issue with LDC. Zero-length static arrays are so special because they are the only type with a size of 0. Empty structs have a size of 1. If I recall correctly, we ended up ignoring zero-sized aggregate fields in the backend and passing/returning them as byte (analogous to empty structs).