Red Hat Bugzilla – Bug 155641
Forward reference in extern array reference causes error.
Last modified: 2007-11-30 17:11:04 EST
Description of problem:
A valid forward reference to a structure in an external reference is errored by
Version-Release number of selected component (if applicable):
gcc version 4.0.0 20050405 (Red Hat 4.0.0-0.40)
Steps to Reproduce:
1. get test_code.c (from attachment)
2. gcc test_code.c
test_code.c:7: error: array type has incomplete element type
This hasn't ever been an error before, I'm not aware of any specification
changes to the way forward references work.
Created attachment 113510 [details]
A simple compile case to demonstrate the issue.
This is not a bug. Your testcase is not valid ISO C. See ISO C99, 126.96.36.199 Array
declarators: The element type shall not be an incomplete or function type.
Older GCC's issued a pedantic warning (resp. error with -pedantic-errors), in
GCC 4.0.x and later this error is unconditional.