public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51427] New: Less-than-useful error message when union/struct tags conflict
@ 2011-12-05 20:52 ajax at redhat dot com
  2011-12-05 21:33 ` [Bug c++/51427] " dodji at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: ajax at redhat dot com @ 2011-12-05 20:52 UTC (permalink / raw)
  To: gcc-bugs

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: unassigned@gcc.gnu.org
        ReportedBy: ajax@redhat.com
                CC: dodji@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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-12-06 10:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-05 20:52 [Bug c++/51427] New: Less-than-useful error message when union/struct tags conflict ajax at redhat dot com
2011-12-05 21:33 ` [Bug c++/51427] " dodji at gcc dot gnu.org
2011-12-05 22:29 ` dodji at gcc dot gnu.org
2011-12-06  3:15 ` jason at gcc dot gnu.org
2011-12-06 10:08 ` dodji at gcc dot gnu.org
2011-12-06 10:11 ` dodji at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).