PSA: Hidden friends are not reflectable in C++26
Just a curiosity I've come across today, but hidden friends don't seem to be reflectable.
Hidden friends are obviously not members of their parent structs, so `meta::members_of` skips them.
Hidden friends also can't be named directly, so `^^hidden_friend` fails with
> error: 'hidden_friend' has not been declared
This seems to match the wording of the standard and isn't just a quirk of the implementation.
This also means that /u/hanickadot's [`hana:adl<"hidden_friend">(class_type{})`](https://old.reddit.com/r/cpp/comments/1oaug0f/overload_sets_with_c26s_reflection/) fails to resolve with
> 'res(args...)' would be invalid: type 'hana::overloads<>' does not provide a call operator
In other words, I have good news and bad news.
- Good news: We still can't recreate the core language in the library.
- Bad news: We still can't recreate the core language in the library.
EDIT: godbolt links:
- https://godbolt.org/z/jrPdsdYvP - `members_of` demo and "has not been declared" (comment out `getX` implementation to see the output of `members_of`).
- https://compiler-explorer.com/z/eE9GTxzWe - `hana::adl` failing with a hidden friend
https://redd.it/1p7fuu8
@r_cpp
Post #24357
14