[PATCH] accept flexible arrays in struct in unions (c++/71912 - [6/7 regression])

Jason Merrill jason@redhat.com
Wed Aug 3 20:02:00 GMT 2016


On Wed, Aug 3, 2016 at 3:10 PM, Martin Sebor <msebor@gmail.com> wrote:
>>>> Do you have ideas about how to improve the naming?  Perhaps change
>>>> TYPE_ANONYMOUS_P to TYPE_NO_LINKAGE_NAME?
>>>
>>> I haven't thought about changing names but TYPE_NO_LINKAGE_NAME
>>> seems better than TYPE_ANONYMOUS_P.
>>
>> Or perhaps TYPE_UNNAMED_P.
>
> TYPE_UNNAMED_P would work but it wouldn't be a replacement for
> TYPE_ANONYMOUS_P.
>
> It sounds like TYPE_ANONYMOUS_P is the right name and the problem
> is that the value it returns isn't accurate until the full context
> to which it applies has been seen.

I think you're thinking of ANON_AGGR_TYPE_P, which identifies
anonymous structs/unions; TYPE_ANONYMOUS_P identifies unnamed classes.

> I wonder if the right solution to this class of problems (which
> are probably unavoidable in the front end as the tree is being
> constructed), is to design an API that prevents using these
> "unreliable" queries until they can return a reliable result.

It would be possible to change ANON_AGGR_TYPE_P to require
COMPLETE_TYPE_P, but a lot of uses will need to be adjusted to avoid
crashing.

Jason



More information about the Gcc-patches mailing list