On Tue, Mar 03, 2026 at 04:52:29PM -0500, Marek Polacek wrote:
> On Tue, Mar 03, 2026 at 08:47:30PM +0100, Thomas Berger wrote:
> > Am Dienstag, 3. März 2026, 16:59:12 Mitteleuropäische Normalzeit schrieb 
> > Marek 
> > Polacek:
> > > Interesting, thanks.  Dan pointed me to
> > > https://cplusplus.github.io/LWG/issue4496
> > > so we should be saying "reachable" rather than "precedes" which is about
> > > name lookup.
> > 
> > But, as far as i can tell, there is no direct effect on members-of-precedes.
> 
> I'm sorry, we discussed this again and I take back what I said earlier.
> 
> members-of-precedes should stay with "precede".  Members of a namespace
> declared in another TU are only found by members_of if they are exported.
> 
> So the earlier testcase should return 1, not 2.
> 

OK, if I'm not misunderstanding what you're saying, I believe this is
what my initial patch currently implements: we always consider whether a
name found by members_of precedes the outermost point of instantiation
in the current TU (and so do not consider whether it precedes any
other point in the instantiation context, in contrast to e.g. ADL).

Either way: Jason, would the original patch be OK for trunk then for
now, with or without this testcase?  And we can adjust later if needed.

Nathaniel

> > I would argue, that using reachable here would break module boundaries:
> > 
> >   export module A;
> >   
> >   namespace NS {
> >     struct impl_with_side_effects {
> >        // ...
> >     }
> > 
> >     export class S {
> >       protected:
> >        const std::unique_ptr<impl_with_side_effects> impl;
> >       // ....
> >     }
> > 
> >   // main.c
> >   import A;
> >   import std;
> > 
> >   consteval void reflect_ns() {
> >      for (auto member : members_of(^^NS)) {
> >         // [[: member ]] into existence
> >      }
> >   }
> > 
> > Would this be legal? Are there any limitations on slice operations?
> > 
> > Thomas
> 
> Marek
> 

Reply via email to