[Bug c++/20401] New: error message is misleading

papadopo at shfj dot cea dot fr gcc-bugzilla@gcc.gnu.org
Thu Mar 10 09:46:00 GMT 2005

The error message in this case is misleading:

$ cat foo.cc
#include <unistd.h>

namespace foo {
typedef long long offset_t;

using namespace std;
using namespace foo;

int main() {
    offset_t fpos;
$ g++ -c foo.cc
foo.cc: In function `int main()':
foo.cc:11: error: `offset_t' undeclared (first use this function)
foo.cc:11: error: (Each undeclared identifier is reported only once for each
   function it appears in.)
foo.cc:11: error: parse error before `;' token

Actually 'offset_t' is declared twice, once in the global namespace in Solaris'
<sys/types.h> and once in the foo namespace.

           Summary: error message is misleading
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: papadopo at shfj dot cea dot fr
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: sparc-sun-solaris2.8


More information about the Gcc-bugs mailing list