Author Topic: Code complete for unnamed struct/union fields  (Read 2946 times)

Offline plainzw

  • Single posting newcomer
  • *
  • Posts: 8
Code complete for unnamed struct/union fields
« on: August 02, 2013, 05:12:42 pm »
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;