public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55252] New: Caret diagnostic doesn't show useful location when macro clashes with name in system header
@ 2012-11-09 18:07 redi at gcc dot gnu.org
  2012-11-09 18:08 ` [Bug c++/55252] " redi at gcc dot gnu.org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: redi at gcc dot gnu.org @ 2012-11-09 18:07 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55252
           Summary: Caret diagnostic doesn't show useful location when
                    macro clashes with name in system header
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: redi@gcc.gnu.org


(preprocessed source doesn't show the error due to the system_header pragma)


$ cat test.cc
#define bar 1
#include "header.h"
$ cat header.h
#pragma GCC system_header
int bar = 0;
$ g++ test.cc
test.cc:1:13: error: expected unqualified-id before numeric constant
 #define bar 1
             ^

This is no help because it doesn't point you to the line in header.h that
clashes with 'bar'

Without the system_header pragma you get

test.cc:1:13: error: expected unqualified-id before numeric constant
 #define bar 1
             ^
header.h:2:5: note: in expansion of macro 'bar'
 int bar = 0;
     ^

Which at least shows both locations, although the first diagnostic is still
confusing ... are the two locations backwards?  The "expected unqualified-id
before numeric constant" should point to "int bar = 0;"


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

end of thread, other threads:[~2015-02-03 10:35 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-09 18:07 [Bug c++/55252] New: Caret diagnostic doesn't show useful location when macro clashes with name in system header redi at gcc dot gnu.org
2012-11-09 18:08 ` [Bug c++/55252] " redi at gcc dot gnu.org
2012-11-09 21:02 ` manu at gcc dot gnu.org
2012-11-10 22:58 ` manu at gcc dot gnu.org
2012-11-10 23:10 ` manu at gcc dot gnu.org
2012-11-10 23:20 ` redi at gcc dot gnu.org
2012-11-19 16:17 ` dodji at seketeli dot org
2012-11-19 16:34 ` dodji at seketeli dot org
2012-11-19 16:50 ` manu at gcc dot gnu.org
2012-11-19 17:06 ` dodji at seketeli dot org
2012-11-19 17:18 ` dodji at seketeli dot org
2013-11-01 15:30 ` manu at gcc dot gnu.org
2013-11-01 21:33 ` manu at gcc dot gnu.org
2014-05-13 15:53 ` tromey at gcc dot gnu.org
2014-07-15 16:29 ` tromey at gcc dot gnu.org
2014-07-15 16:32 ` tromey at gcc dot gnu.org
2015-02-01 20:29 ` manu at gcc dot gnu.org
2015-02-03 10:35 ` 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).