xiao...@gentux test $ cat unamed.c
struct test {
        struct {
                int a;
        };
};

int main()
{
        struct test t1;
        t1.a = 0; /* it is OK */

        struct test t2 = {.a = 0}; /* error */

        return 0;
}
xiao...@gentux test $ gcc unamed.c
unamed.c: In function 'main':
unamed.c:12: error: unknown field 'a' specified in initializer


-- 
           Summary: Can't initial the fields of unamed struct/union.
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: xiaosuo at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40656

Reply via email to