User forums > Using Code::Blocks

Code complete for unnamed struct/union fields

(1/1)

plainzw:
when a struct contains a unnamed union(struct) which contains another struct, code complete can't display the fields of struct inside the unnamed union.

struct TestB
{
    int a;
    int b;
};

struct TestA
{
    union
    {
        TestB c;
        int d;
    };
};

int main()
{
    struct TestA t;
    t.c.a = 5;
    return 0;
}

when typing "t.c." ,code complete doesn't show the fields "a" and "b" of struct TestB. However,it works fine when defining a unnamed union variable like this:
union
{
     TestB c;
     int d;
}u;




Navigation

[0] Message Index

Go to full version