This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c/5336: initializer element is not constant



>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]