This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/16804] New: Function pointer assignment/initialization (missing warning)
- From: "terra at gnome dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 Jul 2004 17:17:59 -0000
- Subject: [Bug c/16804] New: Function pointer assignment/initialization (missing warning)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Code:
enum Moo { Baa, Oink };
static unsigned int quack (void) { return 0; }
enum Moo (*Miau) (void) = quack;
> gcc-3.4 -Wall -c ~/foo.c
> gcc-2.95.2 -Wall -c ~/foo.c
> /opt/SUNWspro/bin/cc -V -c ~/foo.c
cc: Sun WorkShop 6 update 2 C 5.3 Patch 111679-08 2002/05/09
acomp: Sun WorkShop 6 update 2 C 5.3 Patch 111679-08 2002/05/09
"/home/welinder/foo.c", line 3: warning: initialization type mismatch
> ./check ~/foo.c
/home/welinder/foo.c:3:27: warning: incorrect type in initializer (different
base types)
/home/welinder/foo.c:3:27: expected enum Moo ( *[addressable] [toplevel] Miau
)( ... )
/home/welinder/foo.c:3:27: got unsigned int ( static [addressable] [toplevel]
*<noident> )( ... )
Note the "unsigned". Without that, I do get a warning.
--
Summary: Function pointer assignment/initialization (missing
warning)
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: terra at gnome dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: sparc-sun-solaris2.8
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16804