This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/39581] New: VLA types at file scope wrongly rejected
- From: "jsm28 at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Mar 2009 20:01:32 -0000
- Subject: [Bug c/39581] New: VLA types at file scope wrongly rejected
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
GCC gives an error "variable-size type declared outside of any function"
for code such as:
int a;
int b = sizeof (int (*)[a]);
As far as I can tell there is no basis for this in C99; the sizeof expression
certainly has result an integer constant in this case and its operand
is not evaluated. It's declarations of ordinary identifiers with variably
modified type that aren't allowed outside functions.
Similarly, casts to variably modified types should be permitted at file
scope under similar circumstances to those accepted in static initializers
in gcc.dg/c99-const-expr-11.c (and gnu99-const-expr-3.c).
--
Summary: VLA types at file scope wrongly rejected
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jsm28 at gcc dot gnu dot org
OtherBugsDependingO 16989
nThis:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39581