[Issue 13191] New: Silenced forward struct reference error
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Jul 22 11:08:11 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13191
Issue ID: 13191
Summary: Silenced forward struct reference error
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: diagnostic
Severity: normal
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: blah38621 at gmail.com
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.
--
More information about the Digitalmars-d-bugs
mailing list