[Bug c++/122875] [reflection] ICE on invalid std::meta::substitute()

boris.staletic at protonmail dot com gcc-bugzilla@gcc.gnu.org
Sat Feb 14 09:18:46 GMT 2026


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

--- Comment #9 from Boris Staletic <boris.staletic at protonmail dot com> ---
>> foo.cpp:10:29: error: uncaught exception of type ‘std::meta::exception’; ‘what()’: ‘invalid argument to can_substitute’

> Isn't that correct?  I mean, bases_of returns a vector of reflections of the direct base class relationship, something you can't without reflection get hand on and use as a template parameter.  Using {type_of(bases_of(^^B, uctx)[0])} or {parent_of(bases_of(^^B, uctx)[0])} would be meaningful, or applying on all members of the vector type_of or parent_of.

So it is. When I wrote the last comment I had been under the impression that
`bases_of()` would return a range of type reflections, but it's indeed a range
of direct base relationships.
That means gcc behaves correctly as far as this bug report is concerned.


More information about the Gcc-bugs mailing list