Compiler incorrectly requires integer constant in array declarator parameter

Started by skeeto, June 17, 2016, 11:15:50 PM

Previous topic - Next topic

skeeto

When I try to compile code containing the following prototype:

void foo(unsigned n, char s[static n]);

The compiler reports "error #2111: Integer expression must be constant." However, this is a valid declarator in C99 and C11 and the compiler should not reject it. The constant and non-static forms are accepted:

void foo(unsigned n, char s[static 1]);
void foo(unsigned n, char s[n]);