This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/81677] Can't declare pointer to array of incomplete type in struct
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 02 Aug 2017 22:16:07 +0000
- Subject: [Bug c/81677] Can't declare pointer to array of incomplete type in struct
- Auto-submitted: auto-generated
- References: <bug-81677-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81677
--- Comment #3 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
There is no such thing as an array type whose element is incomplete - you
can't construct, or describe, such a type in C at all, and attempts to do
so have undefined behavior in C90, are constraint violations in C99 (with
a slight ambiguity about the case of array parameters decaying to
pointers, but it's generally understood the constraint / undefinedness
applies before decay in the case). Because the type doesn't exist,
neither does a pointer to such a type, as pointer types can only be
derived from types that exist, not from types that don't exist.