Bug 16880 - int i[foo,1];
Summary: int i[foo,1];
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-04 19:13 UTC by M Welinder
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host: sparc-sun-solaris2.8
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description M Welinder 2004-08-04 19:13:13 UTC
static void foo (void) { }
void bar (void) { int i[foo,1]; }

-->

> gcc-3.4 -Wall -c ~/foo.c
/home/welinder/foo.c: In function `bar':
/home/welinder/foo.c:2: error: parse error before ',' token

Adding () makes things work.
Comment 1 Falk Hueffner 2004-08-04 19:16:43 UTC
That seems like exactly the correct behaviour to me. Where do you see the bug?
Comment 2 M Welinder 2004-08-04 19:18:47 UTC
I would be claiming that "foo,1" means the same as "(foo,1)" which is a constant
expression with the value 1.  Thus I want a one-element array.
Comment 3 Falk Hueffner 2004-08-04 19:22:26 UTC
In the [], there can only be an assignment-expression. A comma operator
is not an assignment-expression.