https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120775

--- Comment #37 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Boris Staletic from comment #36)
> I've gone through all of the examples in P2996 and found five errors
> preventing Marek's fork from compiling all of them.
> 
> See: https://godbolt.org/z/chYM1zPbh
> 
> To elaborate:
> 
> - The first error is not related to reflections, but has to do with
> constexpr reference to local.
> - The second error, I'm not sure, but could also be outside of the scope of
> reflections and more to do with expansion statements.
> - The third error is finicky. Changing the formatting can make it go away.
> It prevents, sometimes, expressions like `obj.[:members[Is]:]...`, where
> `Is` is a pack from an index sequence.
> - The fourth says `obj.[:member_refl:]` is ambiguous when `obj` has multiple
> members named `_`. According to P2996, name lookup shouldn't be performed.
> - Finally, there's an ICE when trying to call `access_context::unchecked()`
> from inside a template.
> 
> Regarding "no name lookup", P2996 says this:
> 
> > Note that a “member access splice” like s.[:member_number(1):] is a more 
> > direct
> > member access mechanism than the traditional syntax. It doesn’t involve 
> > member
> > name lookup, access checking, or — if the spliced reflection value 
> > represents a
> > member function — overload resolution.
> 
> I also have a library that relies on C++26 reflections, but I have not yet
> tried to compile it with Marek's fork, as patterns like those that trigger
> the second and third error above do show up in my library.
> Either way, the library is available at:
> https://codeberg.org/bstaletic/pymetabind

The ICE in tsubst_expr is likely PR122658.  
Regarding some cases of expansion statements, there is
https://gcc.gnu.org/pipermail/gcc-patches/2025-November/700380.html
patch waiting for review, but more importantly expansion statements are known
not to work with define_static_array directly in the current expansion
statement definition, see https://github.com/cplusplus/CWG/issues/805
I have a patch in testing for that but I think the CWG needs to decide first
what they want.  A workaround that works for me is template for (constexpr auto
m : (const std::span <const ...> define_static_array (...)).
The "_" case is a known issue, see e.g.
https://forge.sourceware.org/marek/gcc/src/branch/reflection/gcc/testsuite/g++.dg/reflect/member15.C
mentioning it or
the
https://forge.sourceware.org/marek/gcc/commit/c9bc89c30bd7ade9e9c7d5d908c0d3272675ec08
commit message for details, I hope we'll work on that next week.

Reply via email to