This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/18097] New: Misleading diagnostic with ambiguous typedef
- From: "loose at astron dot nl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Oct 2004 12:41:40 -0000
- Subject: [Bug c++/18097] New: Misleading diagnostic with ambiguous typedef
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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