On 22 Jun 2019, at 21:16, Michael Matz <matz....@frakked.de<mailto:matz....@frakked.de>> wrote:
struct s { char a; enum e b[]; } s; struct t { int a[3]; void b[]; } t; typedef void u; struct v { int a[3]; u b[]; } v; struct w { int a[3]; struct n b[]; } w; The thing to realize about all these invalid examples is, that it's not the struct decl which is wrong, i.e. you don't need to change anything within struct_decl or struct_layout. It's already the array declarator itself which is wrong: an array declarator requires a complete element type. So, what you want to change is post_type (which cares for array and function declarators, given a base type) so that the incoming type is complete if necessary. So, pushing the previous stuff down the stack and investigating post_type, it is currently making a minimal effort to reject arrays of functions, and I tried to insert a better filter at the place where the check was (see attached patch). The new version continues to reject this example: typedef void f(void); f t[3]; (with a more generic message) The new version also rejects all my previous examples quoted above, and the following, which is currently accepted because type->t is not masked in the current implementation: const f t[3]; If this patch can be tweaked into something acceptable, I will also add tests for the new rejected constructs and validate the message change for the existing test. Pascal
arrays_of_incomplete.patch
Description: arrays_of_incomplete.patch
_______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel