This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
GCC 3.1.1 --std=c99: initializer element is not constant ...
- From: Craig Newell <craign at ieee dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 26 May 2002 15:17:55 -0400 (EDT)
- Subject: GCC 3.1.1 --std=c99: initializer element is not constant ...
Hi There,
I have some code that compiles fine with GCC 3.0.x but fails with GCC
3.1.x with an "initializer element is not constant" error. Here is the
smallest example I could find:
--------------
typedef struct Lock Lock;
struct Lock {
void *holder;
};
Lock lock = (Lock){ (void*)0 };
--------------
Using GCC 3.0.x it builds fine with both "--std=c89" and "--std=c99" but
with "GCC 3.1.1 20020525 (prerelease)" it only builds with "--std=c89" and
fails with the "initializer element is not constant" error with
"--std=c99". Is there some reason why "NULL (void *)0" is not constant
anymore in "c99"?
Thanks,
CraigN
--
Craig Newell email: CraigN@ieee.org
Free Spirit icbm: N 42°38'47" W 71°18'19"