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


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

Reply via email to