https://gcc.gnu.org/g:2ab314d52bf762059d6c15caf007151381180773
commit r16-6984-g2ab314d52bf762059d6c15caf007151381180773 Author: Marek Polacek <[email protected]> Date: Thu Jan 22 12:03:01 2026 -0500 c++/reflection: update class_members_of comment Explain why TYPE_DECLs in TYPE_FIELDS go at the end. gcc/cp/ChangeLog: * reflect.cc (class_members_of): Update a comment to mention finish_member_declaration. Diff: --- gcc/cp/reflect.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/cp/reflect.cc b/gcc/cp/reflect.cc index 9f979b5c0e73..c1173ced1688 100644 --- a/gcc/cp/reflect.cc +++ b/gcc/cp/reflect.cc @@ -6621,8 +6621,9 @@ class_members_of (location_t loc, const constexpr_ctx *ctx, tree r, get_reflection_raw (loc, m)); } } - /* TYPE_DECLs in TYPE_FIELDS come after other decls, so for members_of - the declaration order is not preserved. */ + /* TYPE_DECLs in TYPE_FIELDS come after other decls due to the "struct + stat hack" (see finish_member_declaration), so for members_of the + declaration order is not preserved. */ if (kind == METAFN_MEMBERS_OF && elts) elts->qsort (members_cmp); if (kind == METAFN_MEMBERS_OF && !implicitly_declared.is_empty ())
