#include <stdio.h> template <typename TYPE> struct Base { Base() { //this unqualified call works fine within the base class voidFunc(); } void voidFunc() { printf("voidFunc()!\n"); } //a public variable TYPE m_publicVar; }; template <typename TYPE> struct Child : public Base<TYPE> { Child() { //calling fully qualified works fine Base<TYPE>::voidFunc(); //this spits out //"error: there are no arguments to `voidFunc' that depend on a template parameter, so a declaration of `voidFunc' must be available // (if you use `-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)" //and will compile and link with -fpermissive voidFunc(); if (m_publicVar) { //this var access will not compile regardles of -fpermissive printf("m_publicVar!\n"); } } }; int main(int argc, const char* argv) { Child<int> child; return 0; }
The Error is correct. See http://gcc.gnu.org/gcc-3.4/changes.html .