possible namespace lookup bug

Stephen Vavasis vavasis@CS.Cornell.EDU
Thu Sep 24 10:27:00 GMT 1998


The program below gives a "parse" error apparently because it does not
recognize the name "A".  This problem is fixed by qualifying A with
namespaces.  I'm not sure if this is a bug since I don't know what the
standard says about looking up base class names.  But KCC 3.2f and VC++
5.0 both accept this program without a complaint, so possibly EGCS 1.1
is in error.

-- Steve Vavasis


------------ error message:

syn.cs.cornell.edu> g++ -c -v inhtest.cpp
g++ -c -v inhtest.cpp
Reading specs from
/usr/local/gnu/egcs-1.1b/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.91.57/specs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)

/usr/local/gnu/egcs-1.1b/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.91.57/cpp
-lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus
-D__GNUC_MINOR__=91 -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__
-D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix
-Asystem(unix) -Asystem(svr4) -D__EXCEPTIONS -D__GCC_NEW_VARARGS__
-Acpu(sparc) -Amachine(sparc) inhtest.cpp /var/tmp/ccsKzeAw.ii
GNU CPP version egcs-2.91.57 19980901 (egcs-1.1 release) (sparc)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/gnu/egcs-1.1b/include/g++
 /usr/local/include
 /usr/local/gnu/egcs-1.1b/sparc-sun-solaris2.5/include

/usr/local/gnu/egcs-1.1b/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.91.57/include
 /usr/include
End of search list.

/usr/local/gnu/egcs-1.1b/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.91.57/cc1plus
/var/tmp/ccsKzeAw.ii -quiet -dumpbase inhtest.cc -version -o
/var/tmp/cc8yUdZ4.s
GNU C++ version egcs-2.91.57 19980901 (egcs-1.1 release)
(sparc-sun-solaris2.5) compiled by GNU C version egcs-2.91.57 19980901
(egcs-1.1 release).
inhtest.cpp:14: parse error before `{'
syn.cs.cornell.edu> 

------------- offending program



namespace N1 {
  namespace N2 {
    class A;
    class B;
  }
}

class N1::N2::A {
};


class N1::N2::B : public A { // EGCS error on this line
};



More information about the Gcc-bugs mailing list