https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124200
--- Comment #8 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
> (In reply to Jakub Jelinek from comment #6)
> > Note, for members_of vs. modules there is another problem: we order
> > reflections in *members_of returned vectors by DECL_UID (because for class
> > queries they are required to be ordered by the order of declarations - and
> > unfortunately TYPE_FIELDS are only partially ordered by the order of
> > declarations - and for namespaces it is nice to have predictable order).
> > Now, because the standard doesn't say anything about ordering of namespace
> > queries, if the above patch results in some consistent ordering, not e.g.
> > dependent on compiler AS randomization, that is fine,
>
> Namespace-scope declarations should be deterministic, for declarations that
> don't have any ordering requirements we fall back to using DECL_UID to sort
> them; so the order won't really be predictable but at least it won't be
> completely random.
Also note that order will change between `-f{no-,}module-lazy`; when doing lazy
loading then the order will be based on whatever names happened to loaded first
I guess if we're sorting based on DECL_UID. If nothing was loaded first then
this patch Thomas and I have been working on will load by order of the bindings
on the NAMESPACE_DECL and then order of module imports. But also dependency
ordering will mess with this too.