On Wed, 12 Nov 2025, Qing Zhao wrote:

> > There are the various extensions (-fms-extensions / -fplan9-extensions) to 
> > consider as well, but it might be reasonable to say that only genuinely 
> > anonymous struct / union members get the special counted_by handling,
> 
> So, in C FE, what’s the best way to determine whether the anonymous 
> struct/union is
> genuine or not? (The DECL_CONTEXT of this anonymous structure/union is 
> NULL_TREE?)

You can't tell until some time after the definition is complete, because 
you need to see whether the type is used as the type of an unnamed field 
(possibly with qualifiers).

Maybe this suggests that, as in other cases, an anonymous structure or 
union involving counted_by should actually be required to be valid without 
reference to the containing struct or union after all - that's how things 
generally work with anonymous structs and unions.  That is, it would be OK 
for an outer struct or union to have counted_by pointing to a count in an 
inner anonymous struct or union, but not vice versa.

-- 
Joseph S. Myers
[email protected]

Reply via email to