[Bug c++/37933] New: reference to ... is amibgous: same error shown twice for same line of code

edwintorok at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Oct 28 12:45:00 GMT 2008


$ cat test.cpp
namespace x {
        extern char *foo;
};
using namespace x;
char *foo;
char bar()
{
        return *foo;
}

$ g++ test.cpp -fsyntax-only
test.cpp: In function ‘char bar()’:
test.cpp:8: error: reference to ‘foo’ is ambiguous
test.cpp:5: error: candidates are: char* foo
test.cpp:2: error:                 char* x::foo
test.cpp:8: error: reference to ‘foo’ is ambiguous
test.cpp:5: error: candidates are: char* foo
test.cpp:2: error:                 char* x::foo

The same error is shown twice.
I think it would be enough to show the error once.

This is with:
$ g++ -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.2-1'
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3
--program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug
--enable-objc-gc --enable-mpfr --enable-cld --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.3.2 (Debian 4.3.2-1)

Same happens with g++-4.2, and trunk (r141407), g++-4.1 appears to infloop.


-- 
           Summary: reference to ... is amibgous: same error shown twice for
                    same line of code
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: edwintorok at gmail dot com
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


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



More information about the Gcc-bugs mailing list