This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Problems with static member templates
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Problems with static member templates
- From: Ivan199847 at aol dot com
- Date: Tue, 16 Nov 1999 23:55:36 EST
The problems below were observed in gcc 2.95.2 19991024 (release) using -g
-Wall, on an Intel P2-333 running Win98, using an unmodified compiler
downloaded in binary form from
ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/cygwin/gcc-2.95.2/gcc-2.95.2-cy
gb20.tar.gz. Both programs are legal C++ AFAICT; both produced error
messages. I would appreciate it if you could look into them.
Program 1:
class Base
{
public:
template<typename T>
Base(T* pT)
{
T::foo<T>();
}
};
class Derived : public Base
{
public:
Derived() : Base(this) {}
template<typename T>
static void foo() {}
};
int main()
{
return 0;
}
This was rejected with
test1.cpp: In method `Base::Base(T *)':
test1.cpp:7: parse error before `>'
As a workaround, I tried Program 2:
class Base
{
public:
template<typename T>
Base(T* pT)
{
T::foo((T*)0);
}
};
class Derived : public Base
{
public:
Derived() : Base(this) {}
template<typename T>
static void foo(T* pT) {}
};
int main()
{
return 0;
}
This was also rejected, with an Internal compiler error at line 17.
Best regards,
Ivan J. Johnson