https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43064

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=45431

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
In this similar case the C front end gets the location right, and also prints a
note with the name of the field:

#include <stddef.h>
struct X { int i; int j; };
struct X x = {
  NULL,
  2
};

$ gcc -Wall s.c -c
s.c:4:3: warning: initialization makes integer from pointer without a cast
[-Wint-conversion]
   NULL,
   ^~~~
s.c:4:3: note: (near initialization for ‘x.i’)

$ g++ -Wall s.c -c
s.c:6:1: warning: converting to non-pointer type ‘int’ from NULL
[-Wconversion-null]
 };
 ^

Reply via email to