Deutsch English Français Italiano |
<87sepa36nv.fsf@bsb.me.uk> View for Bookmarking (what is this?) Look up another Usenet article |
Path: not-for-mail From: Ben Bacarisse <ben@bsb.me.uk> Newsgroups: comp.lang.c Subject: Re: Struct Error Date: Wed, 22 Jan 2025 21:00:52 +0000 Organization: A noiseless patient Spider Lines: 43 Message-Id: <87sepa36nv.fsf@bsb.me.uk> References: <vmr5gg$137jo$1@dont-email.me> <20250122112439.579@kylheku.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Date: Wed, 22 Jan 2025 22:01:00 +0100 (CET) Injection-Info: dont-email.me; posting-host="636b5eb64346436a9521a6611bf4bb4c"; logging-data="1265238"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Xcsrl2xgQkAndrp/XlVHgc7LyakPgt6I=" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:mOYQad1KyM/1Mn+AS5k3l6Vddwg= sha1:/E8wOaQIklxJaD7fYbxc3HodBSY= X-Bsb-Auth: 1.da0ce6ced6617d188e17.20250122210052GMT.87sepa36nv.fsf@bsb.me.uk Bytes: 2155 Kaz Kylheku <643-408-1753@kylheku.com> writes: > On 2025-01-22, bart <bc@freeuk.com> wrote: >> Gcc 14.1 gives me an error compiling this code: >> >> struct vector; >> struct scenet; >> >> struct vector { >> double x; >> double y; >> double z; >> }; >> >> struct scenet { >> struct vector center; >> double radius; >> struct scenet (*child)[]; >> }; >> >> The error is: >> >> error: array type has incomplete element type 'struct scenet' >> struct scenet (*child)[]; >> ^~~~~ > > This looks like a bug to me. There is on reason why an > incomplete array type (a pointer to which /is/ allowed!) > should be constrained to have a complete element. It may be a bug in the standard, but it's not a bug in the compiler: 6.7.6.2 Array declarators Constraints ... The element type shall not be an incomplete or function type. ... There is no dispensation that avoids this constraint when a pointer to such an array is being declared (the constraint is on the array declarator) nor when is type will be soon completed. -- Ben.