Currently the following code produces 4 errors, all of which are completly and
utterly useless.
main.d(7): Error: variable main.SymbolType.PointerData.size conflicts with
variable main.SymbolType.PointerData.size at main.d(7)
main.d(8): Error: variable main.SymbolType.PointerData.typePointedTo conflicts
with variable main.SymbolType.PointerData.typePointedTo at main.d(8)
main.d(7): Error: variable main.SymbolType.PointerData.size conflicts with
variable main.SymbolType.PointerData.size at main.d(7)
main.d(8): Error: variable main.SymbolType.PointerData.typePointedTo conflicts
with variable main.SymbolType.PointerData.typePointedTo at main.d(8)
struct SymbolType
{
static struct PointerData
{
ubyte size;
SymbolType typePointedTo;
}
union
{
PointerData pointerData;
}
}
However something magical happens when we move the union above the PointerData
struct, we get an extra error that we didn't get before:
main.d(10): Error: struct main.SymbolType.PointerData no size yet for forward
reference
This code will never ever be able to compile due to the fact SymbolType is a
struct, however that error appears to be getting silenced if the union is after
the struct declaration. If the anonomous union is replaced with a named union,
the error is no longer dependent on the location of the union declaration.
This should really only be producing 1 error, and that is the "no size yet"
error. It should also be being displayed on the member that requires the
forward reference, in this case, typePointedTo, rather than on the struct
declaration itself.