[Bug c/39581] New: VLA types at file scope wrongly rejected
jsm28 at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sun Mar 29 20:01:00 GMT 2009
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
More information about the Gcc-bugs
mailing list