This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
-Wmissing-field-initializers says Âmissing initializer for member when it obviously isn't.
- From: Hi-Angel <hiangel999 at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 10 Sep 2014 14:39:10 +0000
- Subject: -Wmissing-field-initializers says Âmissing initializer for member when it obviously isn't.
- Authentication-results: sourceware.org; auth=none
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