public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ajax at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/51427] New: Less-than-useful error message when union/struct tags conflict
Date: Mon, 05 Dec 2011 20:52:00 -0000	[thread overview]
Message-ID: <bug-51427-4@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2011-12-05 20:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-05 20:52 ajax at redhat dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-51427-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).