[cfe-dev] "error: initializer element is not a compile-time constant"

Sascha Wildner swildner at erpicon.de
Wed Jul 14 06:07:29 PDT 2010


Hi folks,

the following file compiles fine with gcc (4.1.2) but errors with clang 
(108237). It's preprocessed source, and I've been too lazy to isolate a 
short test case, so apologies.

http://yoyodyne.ath.cx/tmp/constant.c

Output:

--------------------
zoot# env CCVER=gcc41 cc -c constant.c -o constant.o
zoot# env CCVER=clang cc -c constant.c -o constant.o
constant.c:4629:48: error: initializer element is not a compile-time 
constant
static struct dm_report_field_type _fields[] = {
                                                ^
1 diagnostic generated.
--------------------

So my question is, is there some knob to make clang behave like gcc 
here? I tried -std=gnu[89]9, but without success.

Regards,
Sascha



More information about the cfe-dev mailing list