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]

Prototype matching bug


EGCS v1.0.1 generates the following error for the code below:

# /iue_6/egcs-test/SunOS5/bin/g++ -c Bug-typedef.cc 
Bug-typedef.cc:16: prototype for `void Derived<Value>::insert(Value &)' does not match any in class `Derived<Value>'
Bug-typedef.cc:12: candidate is: void Derived<Value>::insert(typename Base<Value>::value_type &)
Bug-typedef.cc: In method `void Derived<Value>::insert(Value &)':
Bug-typedef.cc:16: template definition of non-template `void Derived<Value>::insert(Value &)'


--------------------------------------------------------------------
			Bug-typedef.cc
--------------------------------------------------------------------
template <class Value>
class Base
{
public:
  typedef Value value_type;
};

template <class Value>
class Derived : public Base<Value>
{
public:
  void insert(value_type& v);
};

template <class Value>
void Derived<Value>::insert(Value& v) {}
--------------------------------------------------------------------

The verbose compilation output is below:

# /iue_6/egcs-test/SunOS5/bin/g++ -v -c Bug-typedef.cc
Reading specs from /iue_6/egcs-test/SunOS5/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.90.23/specs
gcc version egcs-2.90.23 980102 (egcs-1.0.1 release)
 /iue_6/egcs-test/SunOS5/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.90.23/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=90 -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) Bug-typedef.cc /tmp/cca004LV.ii
GNU CPP version egcs-2.90.23 980102 (egcs-1.0.1 release) (sparc)
#include "..." search starts here:
#include <...> search starts here:
 /iue_6/egcs-test/SunOS5/include/g++
 /usr/local/include
 /iue_6/egcs-test/SunOS5/sparc-sun-solaris2.5/include
 /iue_6/egcs-test/SunOS5/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.90.23/include
 /usr/include
End of search list.
 /iue_6/egcs-test/SunOS5/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.90.23/cc1plus /tmp/cca004LV.ii -quiet -dumpbase Bug-typedef.cc -version -o /tmp/cca004LV.s
GNU C++ version egcs-2.90.23 980102 (egcs-1.0.1 release) (sparc-sun-solaris2.5) compiled by GNU C version egcs-2.90.23 980102 (egcs-1.0.1 release).
Bug-typedef.cc:16: prototype for `void Derived<Value>::insert(Value &)' does not match any in class `Derived<Value>'
Bug-typedef.cc:12: candidate is: void Derived<Value>::insert(typename Base<Value>::value_type &)
Bug-typedef.cc: In method `void Derived<Value>::insert(Value &)':
Bug-typedef.cc:16: template definition of non-template `void Derived<Value>::insert(Value &)'



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