On Tuesday, 6 September 2016 at 12:56:24 UTC, Johan Engelen wrote:
The compiler allows it, but it leads to a bug with CTFE of this code: the assert fails.
Before someone smart tries it, yes the code works with LDC, but wait... swap the order of `first` and `second` in the union, and BOOM! Internally, CTFE of the code leads to a corrupt union initializer array. LDC and DMD do things a little differently in codegen. Oversimplified: LDC will use the first member of the union, DMD the last.
