This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

invalid compilation error


Hello,

This bug may be known, but it was not listed on the "well-known" bugs
list.

gcc version 2.95.1 19990816 (release)
The compiler does not find a method from an inherited class, when a
similar method exists in the derived class (see sample code below)

output follows:

Script started on Thu Dec 09 21:26:41 1999
wms1@siesta cs/student/wms1> cat foo.cc
class A
{
public:
  void doNothing(int x) { }
};

class B : public A
{
public:
  void doNothing(char *x) { }
};

int main(int argc, char *argv[]) {
  B b;
  int x = 3;
  b.doNothing(x);
  return 1;
}
wms1@siesta cs/student/wms1> g++ -v -c foo.cc
Reading specs from /pkg/gc_2.95.1/lib/gcc-lib/sparc-sun-solaris2.7/2.95.1/specs
gcc version 2.95.1 19990816 (release)
 /pkg/gc_2.95.1/lib/gcc-lib/sparc-sun-solaris2.7/2.95.1/cpp -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -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) foo.cc /var/tmp/ccMRApdU.ii
GNU CPP version 2.95.1 19990816 (release) (sparc)
#include "..." search starts here:
#include <...> search starts here:
 /pkg/gc_2.95.1/lib/gcc-lib/sparc-sun-solaris2.7/2.95.1/../../../../include/g++-3
 /pkg/gc_2.95.1/lib/gcc-lib/sparc-sun-solaris2.7/2.95.1/../../../../sparc-sun-solaris2.7/include
 /pkg/gc_2.95.1/lib/gcc-lib/sparc-sun-solaris2.7/2.95.1/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
 /usr/local/include
End of omitted list.
 /pkg/gc_2.95.1/lib/gcc-lib/sparc-sun-solaris2.7/2.95.1/cc1plus /var/tmp/ccMRApdU.ii -quiet -dumpbase foo.cc -version -o /var/tmp/ccwnT2mJ.s
GNU C++ version 2.95.1 19990816 (release) (sparc-sun-solaris2.7) compiled by GNU C version 2.95.1 19990816 (release).
foo.cc: In function `int main(int, char **)':
foo.cc:16: no matching function for call to `B::doNothing (int &)'
foo.cc:10: candidates are: void B::doNothing(char *)

thanks,

-Bill

**********************************************************
* Bill Shapiro, Graduate Student  | billshap@cs.umd.edu  *
* University of Maryland          | Home: (301) 614-9628 *
* Dept. of Computer Science       | Work: (301) 405-2717 *
* http://www.cs.umd.edu/~billshap | Fax:  (301) 405-6707 *
**********************************************************


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]