On Wed, Jan 07, 2026 at 04:11:10PM +0800, Jason Merrill wrote:
> > +     CONSTRUCTOR_APPEND_ELT (elts, NULL_TREE,
> > +                             get_reflection_raw (loc, m));
> > +   }
> > +    }
> > +  delete seen;
> > +  if (elts)
> > +    elts->qsort (members_cmp);
> 
> Is this necessary for namespace members?  The standard seems to only require
> ordering for class members.  I suppose it might still be desirable, though.

It is not necessary from the standard POV.  It is necessary from
reproduceability POV, we don't want to have code generation dependent on
hash table traversal order, have "random" differences in that based on
whether using native compiler or cross-compiler etc., -g vs. -g0, -fchecking
vs. -fno-checking etc.  Doesn't have to be the same sorting as done for class
members, but it was easier that way.  Now the hash table in question uses
IDENTIFIER_HASH_VALUE as the hash fn return, so perhaps it is more stable than
others, but it still depends on how large it actually is (and was in all
steps of being modified) etc.

        Jakub

Reply via email to