This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: size of member `v' is not constant
- To: Stephen Tse <stephent at sfu dot ca>
- Subject: Re: size of member `v' is not constant
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 05 Jun 2001 18:35:01 -0300
- Cc: gcc-help at gcc dot gnu dot org
- Organization: GCC Team, Red Hat
- References: <87itibjupu.fsf@cr610941-a.rct1.bc.wave.home.com>
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