This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/28464] New: template inheritance loses base class scope
- From: "tim at deadlyninja dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Jul 2006 21:41:44 -0000
- Subject: [Bug c++/28464] New: template inheritance loses base class scope
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
#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;
}
--
Summary: template inheritance loses base class scope
Product: gcc
Version: 3.4.6
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tim at deadlyninja dot com
GCC host triplet: i686-pc-linux-gnu-3.4.6
GCC target triplet: i686-pc-linux-gnu-3.4.6
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28464