On Wed, Feb 11, 2026 at 10:02:03AM +0100, Jakub Jelinek wrote:
> On Wed, Feb 11, 2026 at 05:56:27PM +0900, Jason Merrill wrote:
> > On 2/11/26 10:50 AM, Marek Polacek wrote:
> > > Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?
> > >
> > > -- >8 --
> > > This patch improves various reflection diagnostics as discussed in
> > > <https://gcc.gnu.org/pipermail/gcc-patches/2025-December/704168.html>.
> > >
> > > In particular:
> > > - reword "not usable" diagnostics to say what kind of reflections we
> > > expected,
> > > - use the new tree_category to better describe what kind of reflection
> > > we actually got,
> >
> > Hmm, building an error message from strings like this is generally frowned
> > on because it is difficult to translate. Maybe add a %R to cp_printer and a
> > reflection_to_string function to print any kind of reflection?
>
> %R is taken already,
> %r: if pp_show_color(pp), switch to color identified by const char *.
> %R: if pp_show_color(pp), reset color.
Though, why not just use %qE and make sure to pass a REFLECT_EXPR and
ensure it is printed in human readable form (partly kind like
display_string_of, but e.g. with ^^ at the start).
Jakub