[Issue 13470] Crash with final struct containing anonymous union

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jan 19 23:13:02 PST 2015


https://issues.dlang.org/show_bug.cgi?id=13470

--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to 1199223 from comment #0)
> The structure definition:
> http://pastebin.com/bLEDG4KJ

Do not use external website to show issue code. It may be lost accidentally.
And, your code is not enough to reproduce compiler crash. The code:

public final struct Object
{
    @safe public final pure
    {
        mixin(__ObjCtor("Tangible"));
        mixin(__ObjCtor("Entity"));
        mixin(__ObjCtor("Item"));

        mixin(__ObjChk("is_entity", "OBJ_Entity"));
        mixin(__ObjChk("is_tangible", "OBJ_Tangible"));
        mixin(__ObjChk("is_item", "OBJ_Item"));
    }
    private enum : uint8
    {
        OBJ_Tangible = 0,
        OBJ_Item,
        OBJ_Entity
    }
    uint8 identity=0;
    uint8 flags=0;
    union
    {
        Item Item_;
        Entity Entity_;
        Tangible Tangible_;
    };
}

Prints:
test.d(5): Error: undefined identifier __ObjCtor
test.d(6): Error: undefined identifier __ObjCtor
test.d(7): Error: undefined identifier __ObjCtor
test.d(9): Error: undefined identifier __ObjChk
test.d(10): Error: undefined identifier __ObjChk
test.d(11): Error: undefined identifier __ObjChk
test.d(13): Error: undefined identifier uint8
test.d(19): Error: undefined identifier uint8
test.d(20): Error: undefined identifier uint8
test.d(23): Error: undefined identifier Item, did you mean variable Item_?
test.d(24): Error: undefined identifier Entity, did you mean variable Entity_?
test.d(25): Error: undefined identifier Tangible, did you mean variable
Tangible_?

With the latest release 2.066.1.

--


More information about the Digitalmars-d-bugs mailing list