On Fri, Mar 13, 2026 at 05:49:21PM -0400, Jason Merrill wrote: > On 3/3/26 4:48 AM, Thomas Berger wrote: > > Am Dienstag, 3. März 2026, 09:05:22 Mitteleuropäische Normalzeit schrieb > > Jakub > > Jelinek: > > > On Mon, Mar 02, 2026 at 09:38:41PM -0500, Jason Merrill wrote: > > > > Could we use DECL_SOURCE_LOCATION instead? > > > > > > Would that be reliable? > > I dont't think so. > Fair enough. > > It seems like we hit a number of issues due to out-of-order streaming of > class members, could we fix that, e.g. by calling decl_container before > start in decl_value?
Unfortunately not, I don't think; because if we rely just on DECL_UID, that will get set based on the order that an entity got streamed in (which can be affected by lazy loading), and so if a class member has a dependency on another class member, that second class member can get streamed first which would mix up the order. We'd need to somehow guarantee that all class members end up in the same depset, that the depset is always sorted in order of declaration, and that there are no cross-member dependencies that break the order. (This is apart from the fact that I think it would be a lot of work to hanlde FIELD_DECLs with this, since they currently don't get depsets and just get streamed with the class definition, separately from other referenceable declarations which can get streamed independently with their own depsets.) > > This patch may still be the right approach for GCC 16, but it would be nice > if we could do better. > > Jason > My personal feeling is that it would be nice if TYPE_FIELDS was just actually in declaration order, which would make this really simple. Though this of course would not be viable for GCC 16, it looks like there's a few things that currently implicitly assume the current behaviour. Nathaniel
