/*
  gcc -W -c test.c
  test.c:18: warning: (near initialization for ‘m1.h.b’)
*/

struct h {
        int a;
        int b;
};

struct m {
        struct h h;
        int c;
};

struct m m1 = {
        .h.a = 1,
        .c = 2,
};

struct m m2 = {
        .h = {.a = 1},
        .c = 2,
};

m1 has that warning, but m2 is ok.

I hit this with both these:
 gcc version 4.1.1
 gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)

-Geoff


-- 
           Summary: unexplained warning in struct initialization
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: geoffrey dot levand at am dot sony dot com
  GCC host triplet: i386-redhat-linux


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

Reply via email to