Author Topic: Compiler incorrectly requires integer constant in array declarator parameter  (Read 520 times)


  • Guest
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]);