I can't find the relevant bits in the standard, but gcc and clang allow it, so I guess I' wondering if it's a compiler extension or part of the language. Provide a link if you can.
This can arise with things such as this:
extern char arr[];
func(arr[7]); /*No error.*/
LATE EDIT: I figured I'd better get a clear understanding of this, which I never did although I had moved on, so starting a bounty which I will award to the first person to give me a clear, concise reference(es) in the C89 standard as to why this is allowed. C99 is acceptable if nobody can find the answer in C89, but you need to look in the C89 standard first.
The following statement
is a declaration with external linkage, and says that
arr
has a type of array ofchar
, which implies thatarr
can have an incomplete type.According to "6.7 Declarations" (n1570):
And
arr[7]
equals*(arr + 7)
, andarr
need to have a type of "pointer to complete object type", and the type ofarr
will be converted from "array ofchar
" to "pointer tochar
" in this case.According to "6.3.2.1 Lvalues, arrays, and function designators" (n1570):