This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

-Wmissing-field-initializers says Âmissing initializer for member when it obviously isn't.


Below is a sample code to test. GCC with the option allegedly says
that the line Âobj = {0}; isn't initializes Âmystruct::b member to
anything, although it really is.

struct mystruct{
        int a;
        int b[2];
};

int main(){
        mystruct obj = {1,{2,3}};
        printf("%i\n", obj.b[1]);
        obj = {0};
        printf("%i\n", obj.b[1]);
        return 0;
}

A bug?

Version: gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]