On 05/23/2016 07:18 PM, Martin Sebor wrote:
On 05/19/2016 07:30 AM, Jason Merrill wrote:
On 05/18/2016 09:40 PM, Martin Sebor wrote:
The handling of flexible array members whose element type was
dependent tried to deal with the case when the element type
was not yet completed but it did it wrong. The attached patch
corrects the handling by trying to complete the element type
first.
How about changing complete_type to complete the element type even for
an array of unknown bound? It seems to me that it would be useful to do
that to set alignment and 'structor flags even if we can't set TYPE_SIZE.
It would also be useful to have a 'complete type or array of unknown
bound of complete type' predicate to use here and in layout_var_decl,
grokdeclarator, and type_with_alias_set_p.
Thanks for the suggestions. I implemented them in the attached
update to the the patch. The macro I added evaluates its argument
multiple times. That normally isn't a problem unless it's invoked
with a non-trivial argument like a call to complete_type() that's
passed to COMPLETE_TYPE_P() in grokdeclarator. One way to avoid
possible problems due to evaluating the macro argument more than
once is to introduce a helper inline function. I haven't seen
it done in tree.h so I didn't introduce one in this patch either,
but it might be worth considering for the new macro and any other
non-trivial macros like it.
Yes, let's just make it an inline function (of which there are already
quite a few in tree.h).
Jason