http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51427
Bug #: 51427 Summary: Less-than-useful error message when union/struct tags conflict Classification: Unclassified Product: gcc Version: 4.6.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: a...@redhat.com CC: do...@gcc.gnu.org [ajax@f17 tmp]$ cat test.c #ifdef __cplusplus extern "C" { #endif typedef struct _GMutex GMutex; typedef union _GMutex GMutex; #ifdef __cplusplus }; #endif [ajax@f17 tmp]$ g++ -Wall -c -o test.o test.c test.c:5:19: error: ‘union’ tag used in naming ‘struct _GMutex’ [-fpermissive] This message is unhelpful. At the very least it should say where the conflicting typedef came from, since it could easily be in a different file. The text itself is a bit unclear as well, something more like "GMutex already defined as 'struct _GMutex' at ..." might be better. Note that the C frontend gets this right already: [ajax@f17 tmp]$ gcc -Wall -c -o test.o test.c test.c:5:19: error: ‘_GMutex’ defined as wrong kind of tag test.c:5:27: error: conflicting types for ‘GMutex’ test.c:4:28: note: previous declaration of ‘GMutex’ was here