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

* [Bug c++/51427] Less-than-useful error message when union/struct tags conflict
  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 ` dodji at gcc dot gnu.org
  2011-12-05 22:29 ` dodji at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dodji at gcc dot gnu.org @ 2011-12-05 21:33 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51427

Dodji Seketeli <dodji at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011-12-05
         AssignedTo|unassigned at gcc dot       |dodji at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1


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

* [Bug c++/51427] Less-than-useful error message when union/struct tags conflict
  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
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dodji at gcc dot gnu.org @ 2011-12-05 22:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51427

--- Comment #1 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-12-05 22:29:10 UTC ---
Created attachment 25998
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25998
Candidate fix

I am currently bootstrapping this patch.


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

* [Bug c++/51427] Less-than-useful error message when union/struct tags conflict
  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
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2011-12-06  3:15 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51427

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-12-06 03:14:55 UTC ---
The patch is OK.


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

* [Bug c++/51427] Less-than-useful error message when union/struct tags conflict
  2011-12-05 20:52 [Bug c++/51427] New: Less-than-useful error message when union/struct tags conflict ajax at redhat dot com
                   ` (2 preceding siblings ...)
  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
  4 siblings, 0 replies; 6+ messages in thread
From: dodji at gcc dot gnu.org @ 2011-12-06 10:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51427

--- Comment #3 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-12-06 10:06:55 UTC ---
Author: dodji
Date: Tue Dec  6 10:06:49 2011
New Revision: 182043

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182043
Log:
PR c++/51427 - Better diagnostic when union/struct tags conflicts

gcc/cp/

    PR c++/51427
    * parser.c (cp_parser_check_class_key): Add note about earlier
    declaration.

gcc/testsuite/

    PR c++/51427
    * g++.dg/diagnostic/wrong-tag-1.C

Added:
    trunk/gcc/testsuite/g++.dg/diagnostic/wrong-tag-1.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/51427] Less-than-useful error message when union/struct tags conflict
  2011-12-05 20:52 [Bug c++/51427] New: Less-than-useful error message when union/struct tags conflict ajax at redhat dot com
                   ` (3 preceding siblings ...)
  2011-12-06 10:08 ` dodji at gcc dot gnu.org
@ 2011-12-06 10:11 ` dodji at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: dodji at gcc dot gnu.org @ 2011-12-06 10:11 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51427

Dodji Seketeli <dodji at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #4 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-12-06 10:10:44 UTC ---
Fixed in trunk (4.7).


^ 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).