On Wed, Mar 04, 2026 at 01:03:50PM -0500, Jason Merrill wrote:
> > + /* For typedef struct { ... } S; include both the S type
> > + alias (added above) and dealias of that for the originally
> > + unnamed type (added below). */
> > + if (TREE_CODE (b) == TYPE_DECL
> > + && TYPE_DECL_FOR_LINKAGE_PURPOSES_P (b))
>
> Perhaps this...
I think this one can't. The b we want to do this on is the
typedef, i.e. !DECL_IMPLICIT_TYPEDEF_P (b).
> > + CONSTRUCTOR_APPEND_ELT (elts, NULL_TREE,
> > + get_reflection_raw (loc,
> > + strip_typedefs (m)));
> > }
> > }
> > delete seen;
> > --- gcc/cp/class.cc.jj 2026-02-12 17:51:31.801334370 +0100
> > +++ gcc/cp/class.cc 2026-03-03 17:22:57.922677708 +0100
> > @@ -7608,7 +7608,8 @@ find_flexarrays (tree t, flexmems_t *fme
> > if (TREE_CODE (fld) == TYPE_DECL
> > && DECL_IMPLICIT_TYPEDEF_P (fld)
> > && CLASS_TYPE_P (TREE_TYPE (fld))
> > - && IDENTIFIER_ANON_P (DECL_NAME (fld)))
> > + && (IDENTIFIER_ANON_P (DECL_NAME (fld))
> > + || TYPE_DECL_FOR_LINKAGE_PURPOSES_P (fld)))
>
> ...and this should also use WAS_UNNAMED for clarity?
This one can be changed. It will repeat the TREE_CODE (fld) == TYPE_DECL
and DECL_IMPLICIT_TYPEDEF_P (fld) tests done earlier, but guess for
optimized builds those will be optimized away and it will help clarity.
So will test that change.
Jakub