incomplete type & templates
Leslie Kuczynski
lkuczyns@emc.com
Wed Mar 31 15:08:00 GMT 1999
I have a template class defined as follows:
template<class T, int size, T *T::*link, unsigned long T::*Key>
class foo {
...
}
I have another class that has as a data member an instance
of the template class foo:
class bar{
public:
[snip ...]
bar *m_aa;
unsigned long m_bb;
static foo<Mstream, STREAMHASH, &bar::aa, &bar::bb> m_foo;
[snip ...]
}
egcs-1.1.2 running on Linux complains:
../bar.hxx:: incomplete type `bar' does not have member `m_aa'
../bar.hxx:: incomplete type `bar' does not have member `m_bb'
../bar.hxx:: template argument 3 is invalid
../bar.hxx:: template argument 4 is invalid
../bar.hxx:: warning: ANSI C++ forbids declaration `m_foo' with no type
A Unixware compiler does not complain as it seems to be able to figure
out that aa and bb are members of bar before bar's closing brace.
Any suggestions are appreciated.
Thanks,
Leslie Kuczynski
More information about the Gcc
mailing list