public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/18097] New: Misleading diagnostic with ambiguous typedef
@ 2004-10-21 12:41 loose at astron dot nl
  2004-10-21 12:45 ` [Bug c++/18097] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: loose at astron dot nl @ 2004-10-21 12:41 UTC (permalink / raw)
  To: gcc-bugs

GCC generates a misleading diagnostic error with the following code:

<code>
typedef unsigned int int_t;
namespace N 
{
  typedef unsigned long int_t;
}
using namespace N;
int main()
{
  N::int_t nu; // OK.
  int_t u;     // Undeclared? Ambiguous!
}
</code>

$ g++ -v -save-temps tNS.cc
Reading specs from /home/loose/linux/usr/local/gcc-3.4.2/lib/gcc/i686-pc-linux-
gnu/3.4.2/specs
Configured with: ../src/configure --prefix=/home/loose/linux/usr/local/gcc-
3.4.2 --enable-threads
Thread model: posix
gcc version 3.4.2
 /home/loose/linux/usr/local/gcc-3.4.2/libexec/gcc/i686-pc-linux-
gnu/3.4.2/cc1plus -E -quiet -v -D_GNU_SOURCE tNS.cc -mtune=pentiumpro -o tNS.ii
ignoring nonexistent directory "/home/loose/linux/usr/local/gcc-
3.4.2/lib/gcc/i686-pc-linux-gnu/3.4.2/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/loose/linux/usr/local/gcc-3.4.2/lib/gcc/i686-pc-linux-
gnu/3.4.2/../../../../include/c++/3.4.2
 /home/loose/linux/usr/local/gcc-3.4.2/lib/gcc/i686-pc-linux-
gnu/3.4.2/../../../../include/c++/3.4.2/i686-pc-linux-gnu
 /home/loose/linux/usr/local/gcc-3.4.2/lib/gcc/i686-pc-linux-
gnu/3.4.2/../../../../include/c++/3.4.2/backward
 /usr/local/include
 /home/loose/linux/usr/local/gcc-3.4.2/include
 /home/loose/linux/usr/local/gcc-3.4.2/lib/gcc/i686-pc-linux-gnu/3.4.2/include
 /usr/include
End of search list.
 /home/loose/linux/usr/local/gcc-3.4.2/libexec/gcc/i686-pc-linux-
gnu/3.4.2/cc1plus -fpreprocessed tNS.ii -quiet -dumpbase tNS.cc -
mtune=pentiumpro -auxbase tNS -version -o tNS.s
GNU C++ version 3.4.2 (i686-pc-linux-gnu)
        compiled by GNU C version 3.4.2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
tNS.cc: In function `int main()':
tNS.cc:13: error: `int_t' undeclared (first use this function)
tNS.cc:13: error: (Each undeclared identifier is reported only once for each 
function it appears in.)
tNS.cc:13: error: expected `;' before "u"

Note that GCC 3.2.2 also produces this type of diagnostic.

The Intel compiler icc produces the following (more helpful) diagnostic:

$ icc  tNS.cc
tNS.cc(13): error: "int_t" is ambiguous
    int_t u;     // Undeclared? Ambiguous!
    ^

compilation aborted for tNS.cc (code 2)

Browsing through the Bugzilla database I found a bug that appears to be related 
to bug #12582.

-- 
           Summary: Misleading diagnostic with ambiguous typedef
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: loose at astron dot nl
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/18097] Misleading diagnostic with ambiguous typedef
  2004-10-21 12:41 [Bug c++/18097] New: Misleading diagnostic with ambiguous typedef loose at astron dot nl
@ 2004-10-21 12:45 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-21 12:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-21 12:44 -------
It is more than related it is a dup of that bug because the problems are the same.

*** This bug has been marked as a duplicate of 12582 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2004-10-21 12:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-21 12:41 [Bug c++/18097] New: Misleading diagnostic with ambiguous typedef loose at astron dot nl
2004-10-21 12:45 ` [Bug c++/18097] " pinskia at gcc dot gnu dot 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).