c/5336: initializer element is not constant

dima@cc.hut.fi dima@cc.hut.fi
Wed Jan 9 08:36:00 GMT 2002


>Number:         5336
>Category:       c
>Synopsis:       initializer element is not constant
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 09 08:36:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     dima@cc.hut.fi
>Release:        2.96 (*g*), 3.0.1
>Organization:
>Environment:

>Description:
compiler exits with error on code which is legal at least in common sense.



when comiling something like:



int * const ptr1 = (int *) 0xf0f0f0f0;

int * const ptr2 = ptr1;



compiler exits with error "initializer element is not constant", although it sorta is. it's not "a constant", but it sure is "constant".



I'll go dig C docs, if it is indeed so that init element must be "a constant expression" then a change of error message would be good.
>How-To-Repeat:
int * const ptr1 = (int *) 0xf0f0f0f0;

int * const ptr2 = ptr1;
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-prs mailing list