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.
> 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