It's not a bug. When you are using class template, the `total template specialization' may be wrote by someone. Since the C++ compiler expect anything, you should to use one of the following 3 solutions: 1. use `this->Baz()' instead of `Baz()'. 2. write `using Foo<KEY>::Baz();' in the derived class template. 3. use `Foo<KEY>::Baz()' instead of `Baz()'.
It's described in item 43 of this book `Effective C++ 3/e'. (Its title is "Know how to access names in templatized base classes".) On Thu, 19 Jul 2007 10:26:25 -0500, John Gateley wrote > Hi, I've found strange behavior, possibly a bug, but more likely a > problem with my understanding. Here's the code: > > template<class KEY> class Foo { > public: > void Baz() {} > }; > template<class KEY> class Bar : public Foo<KEY> { > public: > void Bum() { Baz(); } > }; > > (I know it doesn't make much sense, I reduced the problem > down to simplest terms). I get an error compiling: > > [EMAIL PROTECTED]:~/tmp$ g++ -c Foo.C > Foo.C: In member function 'void Bar<KEY>::Bum()': > Foo.C:11: error: there are no arguments to 'Baz' that depend on a > template parameter, so a declaration of 'Baz' must be available > Foo.C:11: error: (if you use '-fpermissive', G++ will accept your > code, but allowing the use of an undeclared name is deprecated) > > Can someone tell me why Baz is undeclared here? > > version: > [EMAIL PROTECTED]:~/tmp$ g++ -v > Using built-in specs. > Target: i486-linux-gnu > Configured with: ../src/configure -v --enable-languages=c,c++, > fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with- > system-zlib --libexecdir=/usr/lib --without-included-gettext -- > enable-threads=posix --enable-nls --program-suffix=-4.1 --enable- > __cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable- > mpfr --enable-checking=release i486-linux-gnu Thread model: posix > gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) > > Thanks, > > j > > -- > John Gateley <[EMAIL PROTECTED]>