This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: initializer bug?
- To: Neal Becker <neal at ctd dot comsat dot com>
- Subject: Re: initializer bug?
- From: Jim Wilson <wilson at cygnus dot com>
- Date: Tue, 10 Mar 1998 17:06:38 -0800
- cc: egcs at cygnus dot com
static const int A = 2;
static const int B = A/2;
gcc -c Test.c
Test.c:2: initializer element is not constant
Sure looks constant to me.
It isn't a constant; it is a variable. The value of the variable is constant,
but it is still a variable, and ISO C says that it must be treated as one
in this context.
It is valid C++ however, as C++ handles this case differently than C.
Jim