Call the following snippet `bug.cc':
struct a { static const int size = 0; };
template <typename T> struct p { int a[T::size]; // Here it says "error: creating array with size zero (`0')" };
p<a> n;
template <typename T> struct q { int a[0]; // Here it says nothing! };
q<a> m;
$ g++ -v Reading specs from /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.2/specs Configured with: ../gcc-3.4.2/configure --prefix=/usr/local Thread model: posix gcc version 3.4.2 $ g++ -c bug.cc bug.cc: In instantiation of `p<a>': bug.cc:10: instantiated from here bug.cc:7: error: creating array with size zero (`0') $ /opt/beta/bin/g++ -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../gcc-4.0/gcc/configure --prefix=/opt/beta Thread model: posix gcc version 4.0.0 20050226 (prerelease) $ /opt/beta/bin/g++ -c bug.cc bug.cc: In instantiation of 'p<a>': bug.cc:10: instantiated from here bug.cc:7: error: creating array with size zero ('0')
Should I report this as a bug? If so, which kind of bug is it? All the best,
Roberto
-- Prof. Roberto Bagnara Computer Science Group Department of Mathematics, University of Parma, Italy http://www.cs.unipr.it/~bagnara/ mailto:[EMAIL PROTECTED]