pointsTo() tries to check every member of anonymous union inside struct.

import std.exception;

union U
{
        int i;
        string s;
}

struct S1
{
        int type;
        U u;
}
struct S2
{
        int type;
        union {
                int i;
                string s;
        }
}

void main()
{
        S1 s1;
        s1.u.i = 0x7FFF_FFFF;
        S2 s2;
        s2.i = 0x7FFF_FFFF;
        assert(!pointsTo(s1, s1)); // pass, pointsTo does not look into union
assert(!pointsTo(s2, s2)); // fails because pointsTo tries to check every member of anonymous union
}

IMHO it should ignore unions, anonymous or not, checking every member of them just doesn't make sense.

--
Using Opera's revolutionary email client: http://www.opera.com/mail/

Reply via email to