This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: size of member `v' is not constant


On Jun  5, 2001, Stephen Tse <stephent@sfu.ca> wrote:

> class A { static const int n; int v[n]; };
> const int A::n = 10;

> test.cc:6: size of member `v' is not constant

> Is it a (known) bug?

Yep.  It was a bug in GCC 2.95, that was fixed in 3.0.  You can only
use `n' as a constant expression within the class body if it's
initialized within the class body.  According to the Standard, a
definition outside the class body is still mandated, but no diagnostic
is required if it's missing.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]