[Bug c++/120775] [C++26] P2996R13 - Reflection
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Nov 11 16:57:08 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120775
--- Comment #28 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #27)
> (In reply to Jakub Jelinek from comment #26)
> > https://forge.sourceware.org/marek/gcc/pulls/96 seems to fix that, shall I
> > merge that or do you want something else?
>
> Could we do just
>
> - refl = cxx_constant_value (refl);
> + refl = fold_non_dependent_expr (refl, tf_warning_or_error,
> + /*manifestly_const_eval=*/true);
>
> ?
I think we can't. One, I think we need to handle the processing_template_decl
case more carefully, if it isn't constant, just revert to building SPLICE_EXPR,
while for !processing_template_decl we want to error. And
fold_non_dependent_expr calls maybe_constant_value instead of
cxx_constant_value, so while it is mce_true as well, it doesn't report errors,
just silently returns non-constant.
More information about the Gcc-bugs
mailing list