zero-sized arrays not allowed within templated struct definitions?
Seapig6@aol.com
Seapig6@aol.com
Sat May 22 11:43:00 GMT 1999
[if you need to reply to me directly, please use the kosak@cs.cmu.edu address]
Is there a reason why the g++ extension that permits zero-length arrays is not
permitted within templated structs? It does seem to be permitted within
templated functions:
% cat zero.cc && g++ -v && g++ zero.cc
void func()
{
int a[0]; //permitted
}
template<int N> void tfunc()
{
int a[N]; //permitted
}
struct cow {
int a[0]; //permitted
};
template<int N> struct tcow {
int a[N]; //NOT permitted
};
int main()
{
func();
tfunc<0>();
cow x;
tcow<0> tx;
}
Reading specs from
/afs/cs.cmu.edu/project/cmcl-kosak/various-gcc/egcs-19990517/i386_linux3/lib/g
cc-lib/i686-pc-linux-gnu/egcs-2.93.22/specs
gcc version egcs-2.93.22 19990517 (gcc2 ss-980929 experimental)
zero.cc: In instantiation of `tcow<0>':
zero.cc:27: instantiated from here
zero.cc:19: creating array with size `0'
More information about the Gcc-bugs
mailing list